diff --git a/sdk/netapp/azure-resourcemanager-netapp/CHANGELOG.md b/sdk/netapp/azure-resourcemanager-netapp/CHANGELOG.md index 16c13491c694..0a6951dfc28c 100644 --- a/sdk/netapp/azure-resourcemanager-netapp/CHANGELOG.md +++ b/sdk/netapp/azure-resourcemanager-netapp/CHANGELOG.md @@ -1,7 +1,8 @@ # Release History -## 1.0.0-beta.3 (Unreleased) +## 1.0.0-beta.1 (2021-05-10) +- Azure Resource Manager NetAppFiles client library for Java. This package contains Microsoft Azure SDK for NetAppFiles Management SDK. Microsoft NetApp Files Azure Resource Provider specification. Package tag package-netapp-2021-02-01. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). ## 1.0.0-beta.2 (2021-03-15) diff --git a/sdk/netapp/azure-resourcemanager-netapp/README.md b/sdk/netapp/azure-resourcemanager-netapp/README.md index 5a59e81494fa..291ce95fc604 100644 --- a/sdk/netapp/azure-resourcemanager-netapp/README.md +++ b/sdk/netapp/azure-resourcemanager-netapp/README.md @@ -2,7 +2,7 @@ Azure Resource Manager NetAppFiles client library for Java. -This package contains Microsoft Azure SDK for NetAppFiles Management SDK. Microsoft NetApp Files Azure Resource Provider specification. Package tag package-netapp-2020-12-01. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). +This package contains Microsoft Azure SDK for NetAppFiles Management SDK. Microsoft NetApp Files Azure Resource Provider specification. Package tag package-netapp-2021-02-01. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). ## We'd love to hear your feedback @@ -32,7 +32,7 @@ Various documentation is available to help you get started com.azure.resourcemanager azure-resourcemanager-netapp - 1.0.0-beta.2 + 1.0.0-beta.3 ``` [//]: # ({x-version-update-end}) diff --git a/sdk/netapp/azure-resourcemanager-netapp/pom.xml b/sdk/netapp/azure-resourcemanager-netapp/pom.xml index 42ecb2b52dd5..cdaf99548a83 100644 --- a/sdk/netapp/azure-resourcemanager-netapp/pom.xml +++ b/sdk/netapp/azure-resourcemanager-netapp/pom.xml @@ -13,7 +13,7 @@ jar Microsoft Azure SDK for NetAppFiles Management - This package contains Microsoft Azure SDK for NetAppFiles Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Microsoft NetApp Files Azure Resource Provider specification. Package tag package-netapp-2020-12-01. + This package contains Microsoft Azure SDK for NetAppFiles Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Microsoft NetApp Files Azure Resource Provider specification. Package tag package-netapp-2021-02-01. https://github.com/Azure/azure-sdk-for-java diff --git a/sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/NetAppFilesManager.java b/sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/NetAppFilesManager.java index 4c8096bc73c7..6c68b1201ed8 100644 --- a/sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/NetAppFilesManager.java +++ b/sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/NetAppFilesManager.java @@ -32,7 +32,6 @@ import com.azure.resourcemanager.netapp.implementation.SnapshotPoliciesImpl; import com.azure.resourcemanager.netapp.implementation.SnapshotsImpl; import com.azure.resourcemanager.netapp.implementation.VaultsImpl; -import com.azure.resourcemanager.netapp.implementation.VolumeBackupStatusImpl; import com.azure.resourcemanager.netapp.implementation.VolumesImpl; import com.azure.resourcemanager.netapp.models.AccountBackups; import com.azure.resourcemanager.netapp.models.Accounts; @@ -44,7 +43,6 @@ import com.azure.resourcemanager.netapp.models.SnapshotPolicies; import com.azure.resourcemanager.netapp.models.Snapshots; import com.azure.resourcemanager.netapp.models.Vaults; -import com.azure.resourcemanager.netapp.models.VolumeBackupStatus; import com.azure.resourcemanager.netapp.models.Volumes; import java.time.Duration; import java.time.temporal.ChronoUnit; @@ -68,12 +66,10 @@ public final class NetAppFilesManager { private SnapshotPolicies snapshotPolicies; - private VolumeBackupStatus volumeBackupStatus; + private Backups backups; private AccountBackups accountBackups; - private Backups backups; - private BackupPolicies backupPolicies; private Vaults vaults; @@ -202,7 +198,7 @@ public NetAppFilesManager authenticate(TokenCredential credential, AzureProfile .append("-") .append("com.azure.resourcemanager.netapp") .append("/") - .append("1.0.0-beta.2"); + .append("1.0.0-beta.1"); if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) { userAgentBuilder .append(" (") @@ -229,6 +225,7 @@ public NetAppFilesManager authenticate(TokenCredential credential, AzureProfile .add( new BearerTokenAuthenticationPolicy( credential, profile.getEnvironment().getManagementEndpoint() + "/.default")); + policies.addAll(this.policies); HttpPolicyProviders.addAfterRetryPolicies(policies); policies.add(new HttpLoggingPolicy(httpLogOptions)); HttpPipeline httpPipeline = @@ -296,12 +293,12 @@ public SnapshotPolicies snapshotPolicies() { return snapshotPolicies; } - /** @return Resource collection API of VolumeBackupStatus. */ - public VolumeBackupStatus volumeBackupStatus() { - if (this.volumeBackupStatus == null) { - this.volumeBackupStatus = new VolumeBackupStatusImpl(clientObject.getVolumeBackupStatus(), this); + /** @return Resource collection API of Backups. */ + public Backups backups() { + if (this.backups == null) { + this.backups = new BackupsImpl(clientObject.getBackups(), this); } - return volumeBackupStatus; + return backups; } /** @return Resource collection API of AccountBackups. */ @@ -312,14 +309,6 @@ public AccountBackups accountBackups() { return accountBackups; } - /** @return Resource collection API of Backups. */ - public Backups backups() { - if (this.backups == null) { - this.backups = new BackupsImpl(clientObject.getBackups(), this); - } - return backups; - } - /** @return Resource collection API of BackupPolicies. */ public BackupPolicies backupPolicies() { if (this.backupPolicies == null) { diff --git a/sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/fluent/AccountBackupsClient.java b/sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/fluent/AccountBackupsClient.java index f38463e7b902..1cc9a2256b03 100644 --- a/sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/fluent/AccountBackupsClient.java +++ b/sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/fluent/AccountBackupsClient.java @@ -6,12 +6,12 @@ import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; import com.azure.core.http.rest.Response; import com.azure.core.management.polling.PollResult; import com.azure.core.util.Context; import com.azure.core.util.polling.SyncPoller; import com.azure.resourcemanager.netapp.fluent.models.BackupInner; -import com.azure.resourcemanager.netapp.fluent.models.BackupsListInner; /** An instance of this class provides access to all the operations defined in AccountBackupsClient. */ public interface AccountBackupsClient { @@ -25,8 +25,8 @@ public interface AccountBackupsClient { * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return list of Backups. */ - @ServiceMethod(returns = ReturnType.SINGLE) - BackupsListInner list(String resourceGroupName, String accountName); + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String accountName); /** * List all Backups for a Netapp Account. @@ -39,11 +39,11 @@ public interface AccountBackupsClient { * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return list of Backups. */ - @ServiceMethod(returns = ReturnType.SINGLE) - Response listWithResponse(String resourceGroupName, String accountName, Context context); + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String accountName, Context context); /** - * Get Backup for a Netapp Account. + * Gets the specified backup for a Netapp Account. * * @param resourceGroupName The name of the resource group. * @param accountName The name of the NetApp account. @@ -51,13 +51,13 @@ public interface AccountBackupsClient { * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return backup for a Netapp Account. + * @return the specified backup for a Netapp Account. */ @ServiceMethod(returns = ReturnType.SINGLE) BackupInner get(String resourceGroupName, String accountName, String backupName); /** - * Get Backup for a Netapp Account. + * Gets the specified backup for a Netapp Account. * * @param resourceGroupName The name of the resource group. * @param accountName The name of the NetApp account. @@ -66,14 +66,14 @@ public interface AccountBackupsClient { * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return backup for a Netapp Account. + * @return the specified backup for a Netapp Account. */ @ServiceMethod(returns = ReturnType.SINGLE) Response getWithResponse( String resourceGroupName, String accountName, String backupName, Context context); /** - * Delete Backup for a Netapp Account. + * Delete the specified Backup for a Netapp Account. * * @param resourceGroupName The name of the resource group. * @param accountName The name of the NetApp account. @@ -87,7 +87,7 @@ Response getWithResponse( SyncPoller, Void> beginDelete(String resourceGroupName, String accountName, String backupName); /** - * Delete Backup for a Netapp Account. + * Delete the specified Backup for a Netapp Account. * * @param resourceGroupName The name of the resource group. * @param accountName The name of the NetApp account. @@ -103,7 +103,7 @@ SyncPoller, Void> beginDelete( String resourceGroupName, String accountName, String backupName, Context context); /** - * Delete Backup for a Netapp Account. + * Delete the specified Backup for a Netapp Account. * * @param resourceGroupName The name of the resource group. * @param accountName The name of the NetApp account. @@ -116,7 +116,7 @@ SyncPoller, Void> beginDelete( void delete(String resourceGroupName, String accountName, String backupName); /** - * Delete Backup for a Netapp Account. + * Delete the specified Backup for a Netapp Account. * * @param resourceGroupName The name of the resource group. * @param accountName The name of the NetApp account. diff --git a/sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/fluent/BackupPoliciesClient.java b/sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/fluent/BackupPoliciesClient.java index a56eeccc61ec..8b03fb87707f 100644 --- a/sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/fluent/BackupPoliciesClient.java +++ b/sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/fluent/BackupPoliciesClient.java @@ -139,6 +139,39 @@ BackupPolicyInner create( BackupPolicyInner create( String resourceGroupName, String accountName, String backupPolicyName, BackupPolicyInner body, Context context); + /** + * Patch a backup policy for Netapp Account. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account. + * @param backupPolicyName Backup policy Name which uniquely identify backup policy. + * @param body Backup policy object supplied in the body of the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return backup policy information. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, BackupPolicyInner> beginUpdate( + String resourceGroupName, String accountName, String backupPolicyName, BackupPolicyPatch body); + + /** + * Patch a backup policy for Netapp Account. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account. + * @param backupPolicyName Backup policy Name which uniquely identify backup policy. + * @param body Backup policy object supplied in the body of the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return backup policy information. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, BackupPolicyInner> beginUpdate( + String resourceGroupName, String accountName, String backupPolicyName, BackupPolicyPatch body, Context context); + /** * Patch a backup policy for Netapp Account. * @@ -169,7 +202,7 @@ BackupPolicyInner update( * @return backup policy information. */ @ServiceMethod(returns = ReturnType.SINGLE) - Response updateWithResponse( + BackupPolicyInner update( String resourceGroupName, String accountName, String backupPolicyName, BackupPolicyPatch body, Context context); /** diff --git a/sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/fluent/BackupsClient.java b/sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/fluent/BackupsClient.java index be057da9f666..9ee204731e4a 100644 --- a/sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/fluent/BackupsClient.java +++ b/sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/fluent/BackupsClient.java @@ -12,10 +12,43 @@ import com.azure.core.util.Context; import com.azure.core.util.polling.SyncPoller; import com.azure.resourcemanager.netapp.fluent.models.BackupInner; +import com.azure.resourcemanager.netapp.fluent.models.BackupStatusInner; import com.azure.resourcemanager.netapp.models.BackupPatch; /** An instance of this class provides access to all the operations defined in BackupsClient. */ public interface BackupsClient { + /** + * Get the status of the backup for a volume. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account. + * @param poolName The name of the capacity pool. + * @param volumeName The name of the volume. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the status of the backup for a volume. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + BackupStatusInner getStatus(String resourceGroupName, String accountName, String poolName, String volumeName); + + /** + * Get the status of the backup for a volume. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account. + * @param poolName The name of the capacity pool. + * @param volumeName The name of the volume. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the status of the backup for a volume. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getStatusWithResponse( + String resourceGroupName, String accountName, String poolName, String volumeName, Context context); + /** * List all backups for a volume. * @@ -49,7 +82,7 @@ PagedIterable list( String resourceGroupName, String accountName, String poolName, String volumeName, Context context); /** - * Get a particular backup of the volume. + * Gets the specified backup of the volume. * * @param resourceGroupName The name of the resource group. * @param accountName The name of the NetApp account. @@ -59,14 +92,14 @@ PagedIterable list( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a particular backup of the volume. + * @return the specified backup of the volume. */ @ServiceMethod(returns = ReturnType.SINGLE) BackupInner get( String resourceGroupName, String accountName, String poolName, String volumeName, String backupName); /** - * Get a particular backup of the volume. + * Gets the specified backup of the volume. * * @param resourceGroupName The name of the resource group. * @param accountName The name of the NetApp account. @@ -77,7 +110,7 @@ BackupInner get( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a particular backup of the volume. + * @return the specified backup of the volume. */ @ServiceMethod(returns = ReturnType.SINGLE) Response getWithResponse( diff --git a/sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/fluent/NetAppManagementClient.java b/sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/fluent/NetAppManagementClient.java index 4eda614c754b..4366e9035bcc 100644 --- a/sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/fluent/NetAppManagementClient.java +++ b/sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/fluent/NetAppManagementClient.java @@ -95,11 +95,11 @@ public interface NetAppManagementClient { SnapshotPoliciesClient getSnapshotPolicies(); /** - * Gets the VolumeBackupStatusClient object to access its operations. + * Gets the BackupsClient object to access its operations. * - * @return the VolumeBackupStatusClient object. + * @return the BackupsClient object. */ - VolumeBackupStatusClient getVolumeBackupStatus(); + BackupsClient getBackups(); /** * Gets the AccountBackupsClient object to access its operations. @@ -108,13 +108,6 @@ public interface NetAppManagementClient { */ AccountBackupsClient getAccountBackups(); - /** - * Gets the BackupsClient object to access its operations. - * - * @return the BackupsClient object. - */ - BackupsClient getBackups(); - /** * Gets the BackupPoliciesClient object to access its operations. * diff --git a/sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/fluent/VolumeBackupStatusClient.java b/sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/fluent/VolumeBackupStatusClient.java deleted file mode 100644 index c2685f841d22..000000000000 --- a/sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/fluent/VolumeBackupStatusClient.java +++ /dev/null @@ -1,46 +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.netapp.fluent; - -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.http.rest.Response; -import com.azure.core.util.Context; -import com.azure.resourcemanager.netapp.fluent.models.BackupStatusInner; - -/** An instance of this class provides access to all the operations defined in VolumeBackupStatusClient. */ -public interface VolumeBackupStatusClient { - /** - * Get the status of the backup for a volume. - * - * @param resourceGroupName The name of the resource group. - * @param accountName The name of the NetApp account. - * @param poolName The name of the capacity pool. - * @param volumeName The name of the volume. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the status of the backup for a volume. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - BackupStatusInner get(String resourceGroupName, String accountName, String poolName, String volumeName); - - /** - * Get the status of the backup for a volume. - * - * @param resourceGroupName The name of the resource group. - * @param accountName The name of the NetApp account. - * @param poolName The name of the capacity pool. - * @param volumeName The name of the volume. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the status of the backup for a volume. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Response getWithResponse( - String resourceGroupName, String accountName, String poolName, String volumeName, Context context); -} diff --git a/sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/fluent/models/BackupInner.java b/sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/fluent/models/BackupInner.java index bf5e66981bb0..dbc678e7790e 100644 --- a/sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/fluent/models/BackupInner.java +++ b/sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/fluent/models/BackupInner.java @@ -8,6 +8,7 @@ import com.azure.core.annotation.JsonFlatten; import com.azure.core.management.ProxyResource; import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.netapp.models.BackupType; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; import java.time.OffsetDateTime; @@ -55,10 +56,10 @@ public class BackupInner extends ProxyResource { private String label; /* - * Type of backup adhoc or scheduled + * Type of backup Manual or Scheduled */ @JsonProperty(value = "properties.backupType", access = JsonProperty.Access.WRITE_ONLY) - private String backupType; + private BackupType backupType; /* * Failure reason @@ -72,6 +73,13 @@ public class BackupInner extends ProxyResource { @JsonProperty(value = "properties.volumeName", access = JsonProperty.Access.WRITE_ONLY) private String volumeName; + /* + * Manual backup an already existing snapshot. This will always be false + * for scheduled backups and true/false for manual backups + */ + @JsonProperty(value = "properties.useExistingSnapshot") + private Boolean useExistingSnapshot; + /** * Get the location property: Resource location. * @@ -149,11 +157,11 @@ public BackupInner withLabel(String label) { } /** - * Get the backupType property: Type of backup adhoc or scheduled. + * Get the backupType property: Type of backup Manual or Scheduled. * * @return the backupType value. */ - public String backupType() { + public BackupType backupType() { return this.backupType; } @@ -175,6 +183,28 @@ public String volumeName() { return this.volumeName; } + /** + * Get the useExistingSnapshot property: Manual backup an already existing snapshot. This will always be false for + * scheduled backups and true/false for manual backups. + * + * @return the useExistingSnapshot value. + */ + public Boolean useExistingSnapshot() { + return this.useExistingSnapshot; + } + + /** + * Set the useExistingSnapshot property: Manual backup an already existing snapshot. This will always be false for + * scheduled backups and true/false for manual backups. + * + * @param useExistingSnapshot the useExistingSnapshot value to set. + * @return the BackupInner object itself. + */ + public BackupInner withUseExistingSnapshot(Boolean useExistingSnapshot) { + this.useExistingSnapshot = useExistingSnapshot; + return this; + } + /** * Validates the instance. * diff --git a/sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/fluent/models/BackupsListInner.java b/sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/fluent/models/BackupsListInner.java deleted file mode 100644 index 2a57f3d69d2b..000000000000 --- a/sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/fluent/models/BackupsListInner.java +++ /dev/null @@ -1,54 +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.netapp.fluent.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.util.logging.ClientLogger; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; -import java.util.List; - -/** List of Backups. */ -@Fluent -public final class BackupsListInner { - @JsonIgnore private final ClientLogger logger = new ClientLogger(BackupsListInner.class); - - /* - * A list of Backups - */ - @JsonProperty(value = "value") - private List value; - - /** - * Get the value property: A list of Backups. - * - * @return the value value. - */ - public List value() { - return this.value; - } - - /** - * Set the value property: A list of Backups. - * - * @param value the value value to set. - * @return the BackupsListInner object itself. - */ - public BackupsListInner withValue(List value) { - this.value = value; - return this; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - if (value() != null) { - value().forEach(e -> e.validate()); - } - } -} diff --git a/sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/fluent/models/VolumeInner.java b/sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/fluent/models/VolumeInner.java index 8a74a86689d3..408aa8a01d12 100644 --- a/sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/fluent/models/VolumeInner.java +++ b/sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/fluent/models/VolumeInner.java @@ -57,7 +57,7 @@ public class VolumeInner extends Resource { private VolumePropertiesExportPolicy exportPolicy; /* - * Set of protocol types, default NFSv3, CIFS fro SMB protocol + * Set of protocol types, default NFSv3, CIFS for SMB protocol */ @JsonProperty(value = "properties.protocolTypes") private List protocolTypes; @@ -265,7 +265,7 @@ public VolumeInner withExportPolicy(VolumePropertiesExportPolicy exportPolicy) { } /** - * Get the protocolTypes property: Set of protocol types, default NFSv3, CIFS fro SMB protocol. + * Get the protocolTypes property: Set of protocol types, default NFSv3, CIFS for SMB protocol. * * @return the protocolTypes value. */ @@ -274,7 +274,7 @@ public List protocolTypes() { } /** - * Set the protocolTypes property: Set of protocol types, default NFSv3, CIFS fro SMB protocol. + * Set the protocolTypes property: Set of protocol types, default NFSv3, CIFS for SMB protocol. * * @param protocolTypes the protocolTypes value to set. * @return the VolumeInner object itself. diff --git a/sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/implementation/AccountBackupsClientImpl.java b/sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/implementation/AccountBackupsClientImpl.java index 040941b956f9..25a750b1ad61 100644 --- a/sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/implementation/AccountBackupsClientImpl.java +++ b/sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/implementation/AccountBackupsClientImpl.java @@ -17,6 +17,10 @@ import com.azure.core.annotation.ServiceInterface; import com.azure.core.annotation.ServiceMethod; import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; import com.azure.core.http.rest.Response; import com.azure.core.http.rest.RestProxy; import com.azure.core.management.exception.ManagementException; @@ -28,7 +32,7 @@ import com.azure.core.util.polling.SyncPoller; import com.azure.resourcemanager.netapp.fluent.AccountBackupsClient; import com.azure.resourcemanager.netapp.fluent.models.BackupInner; -import com.azure.resourcemanager.netapp.fluent.models.BackupsListInner; +import com.azure.resourcemanager.netapp.models.BackupsList; import java.nio.ByteBuffer; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; @@ -67,7 +71,7 @@ private interface AccountBackupsService { + "/netAppAccounts/{accountName}/accountBackups") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> list( + Mono> list( @HostParam("$host") String endpoint, @PathParam("subscriptionId") String subscriptionId, @PathParam("resourceGroupName") String resourceGroupName, @@ -119,7 +123,7 @@ Mono>> delete( * @return list of Backups. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listWithResponseAsync(String resourceGroupName, String accountName) { + private Mono> listSinglePageAsync(String resourceGroupName, String accountName) { if (this.client.getEndpoint() == null) { return Mono .error( @@ -152,7 +156,11 @@ private Mono> listWithResponseAsync(String resourceGr this.client.getApiVersion(), accept, context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -167,7 +175,7 @@ private Mono> listWithResponseAsync(String resourceGr * @return list of Backups. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listWithResponseAsync( + private Mono> listSinglePageAsync( String resourceGroupName, String accountName, Context context) { if (this.client.getEndpoint() == null) { return Mono @@ -198,7 +206,11 @@ private Mono> listWithResponseAsync( accountName, this.client.getApiVersion(), accept, - context); + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); } /** @@ -211,17 +223,9 @@ private Mono> listWithResponseAsync( * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return list of Backups. */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono listAsync(String resourceGroupName, String accountName) { - return listWithResponseAsync(resourceGroupName, accountName) - .flatMap( - (Response res) -> { - if (res.getValue() != null) { - return Mono.just(res.getValue()); - } else { - return Mono.empty(); - } - }); + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String accountName) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, accountName)); } /** @@ -229,14 +233,30 @@ private Mono listAsync(String resourceGroupName, String accoun * * @param resourceGroupName The name of the resource group. * @param accountName The name of the NetApp account. + * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return list of Backups. */ - @ServiceMethod(returns = ReturnType.SINGLE) - public BackupsListInner list(String resourceGroupName, String accountName) { - return listAsync(resourceGroupName, accountName).block(); + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String accountName, Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, accountName, context)); + } + + /** + * List all Backups for a Netapp Account. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Backups. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String accountName) { + return new PagedIterable<>(listAsync(resourceGroupName, accountName)); } /** @@ -250,13 +270,13 @@ public BackupsListInner list(String resourceGroupName, String accountName) { * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return list of Backups. */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response listWithResponse(String resourceGroupName, String accountName, Context context) { - return listWithResponseAsync(resourceGroupName, accountName, context).block(); + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String accountName, Context context) { + return new PagedIterable<>(listAsync(resourceGroupName, accountName, context)); } /** - * Get Backup for a Netapp Account. + * Gets the specified backup for a Netapp Account. * * @param resourceGroupName The name of the resource group. * @param accountName The name of the NetApp account. @@ -264,7 +284,7 @@ public Response listWithResponse(String resourceGroupName, Str * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return backup for a Netapp Account. + * @return the specified backup for a Netapp Account. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> getWithResponseAsync( @@ -305,11 +325,11 @@ private Mono> getWithResponseAsync( this.client.getApiVersion(), accept, context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** - * Get Backup for a Netapp Account. + * Gets the specified backup for a Netapp Account. * * @param resourceGroupName The name of the resource group. * @param accountName The name of the NetApp account. @@ -318,7 +338,7 @@ private Mono> getWithResponseAsync( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return backup for a Netapp Account. + * @return the specified backup for a Netapp Account. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> getWithResponseAsync( @@ -360,7 +380,7 @@ private Mono> getWithResponseAsync( } /** - * Get Backup for a Netapp Account. + * Gets the specified backup for a Netapp Account. * * @param resourceGroupName The name of the resource group. * @param accountName The name of the NetApp account. @@ -368,7 +388,7 @@ private Mono> getWithResponseAsync( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return backup for a Netapp Account. + * @return the specified backup for a Netapp Account. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono getAsync(String resourceGroupName, String accountName, String backupName) { @@ -384,7 +404,7 @@ private Mono getAsync(String resourceGroupName, String accountName, } /** - * Get Backup for a Netapp Account. + * Gets the specified backup for a Netapp Account. * * @param resourceGroupName The name of the resource group. * @param accountName The name of the NetApp account. @@ -392,7 +412,7 @@ private Mono getAsync(String resourceGroupName, String accountName, * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return backup for a Netapp Account. + * @return the specified backup for a Netapp Account. */ @ServiceMethod(returns = ReturnType.SINGLE) public BackupInner get(String resourceGroupName, String accountName, String backupName) { @@ -400,7 +420,7 @@ public BackupInner get(String resourceGroupName, String accountName, String back } /** - * Get Backup for a Netapp Account. + * Gets the specified backup for a Netapp Account. * * @param resourceGroupName The name of the resource group. * @param accountName The name of the NetApp account. @@ -409,7 +429,7 @@ public BackupInner get(String resourceGroupName, String accountName, String back * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return backup for a Netapp Account. + * @return the specified backup for a Netapp Account. */ @ServiceMethod(returns = ReturnType.SINGLE) public Response getWithResponse( @@ -418,7 +438,7 @@ public Response getWithResponse( } /** - * Delete Backup for a Netapp Account. + * Delete the specified Backup for a Netapp Account. * * @param resourceGroupName The name of the resource group. * @param accountName The name of the NetApp account. @@ -465,11 +485,11 @@ private Mono>> deleteWithResponseAsync( backupName, this.client.getApiVersion(), context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** - * Delete Backup for a Netapp Account. + * Delete the specified Backup for a Netapp Account. * * @param resourceGroupName The name of the resource group. * @param accountName The name of the NetApp account. @@ -518,7 +538,7 @@ private Mono>> deleteWithResponseAsync( } /** - * Delete Backup for a Netapp Account. + * Delete the specified Backup for a Netapp Account. * * @param resourceGroupName The name of the resource group. * @param accountName The name of the NetApp account. @@ -538,7 +558,7 @@ private PollerFlux, Void> beginDeleteAsync( } /** - * Delete Backup for a Netapp Account. + * Delete the specified Backup for a Netapp Account. * * @param resourceGroupName The name of the resource group. * @param accountName The name of the NetApp account. @@ -561,7 +581,7 @@ private PollerFlux, Void> beginDeleteAsync( } /** - * Delete Backup for a Netapp Account. + * Delete the specified Backup for a Netapp Account. * * @param resourceGroupName The name of the resource group. * @param accountName The name of the NetApp account. @@ -578,7 +598,7 @@ public SyncPoller, Void> beginDelete( } /** - * Delete Backup for a Netapp Account. + * Delete the specified Backup for a Netapp Account. * * @param resourceGroupName The name of the resource group. * @param accountName The name of the NetApp account. @@ -596,7 +616,7 @@ public SyncPoller, Void> beginDelete( } /** - * Delete Backup for a Netapp Account. + * Delete the specified Backup for a Netapp Account. * * @param resourceGroupName The name of the resource group. * @param accountName The name of the NetApp account. @@ -614,7 +634,7 @@ private Mono deleteAsync(String resourceGroupName, String accountName, Str } /** - * Delete Backup for a Netapp Account. + * Delete the specified Backup for a Netapp Account. * * @param resourceGroupName The name of the resource group. * @param accountName The name of the NetApp account. @@ -633,7 +653,7 @@ private Mono deleteAsync(String resourceGroupName, String accountName, Str } /** - * Delete Backup for a Netapp Account. + * Delete the specified Backup for a Netapp Account. * * @param resourceGroupName The name of the resource group. * @param accountName The name of the NetApp account. @@ -648,7 +668,7 @@ public void delete(String resourceGroupName, String accountName, String backupNa } /** - * Delete Backup for a Netapp Account. + * Delete the specified Backup for a Netapp Account. * * @param resourceGroupName The name of the resource group. * @param accountName The name of the NetApp account. diff --git a/sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/implementation/AccountBackupsImpl.java b/sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/implementation/AccountBackupsImpl.java index 4de580d3a3ef..bb26b306532e 100644 --- a/sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/implementation/AccountBackupsImpl.java +++ b/sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/implementation/AccountBackupsImpl.java @@ -4,16 +4,15 @@ package com.azure.resourcemanager.netapp.implementation; +import com.azure.core.http.rest.PagedIterable; import com.azure.core.http.rest.Response; import com.azure.core.http.rest.SimpleResponse; import com.azure.core.util.Context; import com.azure.core.util.logging.ClientLogger; import com.azure.resourcemanager.netapp.fluent.AccountBackupsClient; import com.azure.resourcemanager.netapp.fluent.models.BackupInner; -import com.azure.resourcemanager.netapp.fluent.models.BackupsListInner; import com.azure.resourcemanager.netapp.models.AccountBackups; import com.azure.resourcemanager.netapp.models.Backup; -import com.azure.resourcemanager.netapp.models.BackupsList; import com.fasterxml.jackson.annotation.JsonIgnore; public final class AccountBackupsImpl implements AccountBackups { @@ -29,27 +28,14 @@ public AccountBackupsImpl( this.serviceManager = serviceManager; } - public BackupsList list(String resourceGroupName, String accountName) { - BackupsListInner inner = this.serviceClient().list(resourceGroupName, accountName); - if (inner != null) { - return new BackupsListImpl(inner, this.manager()); - } else { - return null; - } + public PagedIterable list(String resourceGroupName, String accountName) { + PagedIterable inner = this.serviceClient().list(resourceGroupName, accountName); + return Utils.mapPage(inner, inner1 -> new BackupImpl(inner1, this.manager())); } - public Response listWithResponse(String resourceGroupName, String accountName, Context context) { - Response inner = - this.serviceClient().listWithResponse(resourceGroupName, accountName, context); - if (inner != null) { - return new SimpleResponse<>( - inner.getRequest(), - inner.getStatusCode(), - inner.getHeaders(), - new BackupsListImpl(inner.getValue(), this.manager())); - } else { - return null; - } + public PagedIterable list(String resourceGroupName, String accountName, Context context) { + PagedIterable inner = this.serviceClient().list(resourceGroupName, accountName, context); + return Utils.mapPage(inner, inner1 -> new BackupImpl(inner1, this.manager())); } public Backup get(String resourceGroupName, String accountName, String backupName) { diff --git a/sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/implementation/AccountsClientImpl.java b/sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/implementation/AccountsClientImpl.java index 07f9906bce22..b96871cae703 100644 --- a/sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/implementation/AccountsClientImpl.java +++ b/sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/implementation/AccountsClientImpl.java @@ -202,7 +202,7 @@ private Mono> listByResourceGroupSinglePageAsy res.getValue().value(), res.getValue().nextLink(), null)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -361,7 +361,7 @@ private Mono> getByResourceGroupWithResponseAsync( this.client.getApiVersion(), accept, context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -517,7 +517,7 @@ private Mono>> createOrUpdateWithResponseAsync( body, accept, context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -768,7 +768,7 @@ private Mono>> deleteWithResponseAsync(String resource accountName, this.client.getApiVersion(), context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -1000,7 +1000,7 @@ private Mono>> updateWithResponseAsync( body, accept, context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -1240,7 +1240,7 @@ private Mono> listNextSinglePageAsync(String n res.getValue().value(), res.getValue().nextLink(), null)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** diff --git a/sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/implementation/BackupImpl.java b/sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/implementation/BackupImpl.java index b04df2e10e84..3e7f48717f2f 100644 --- a/sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/implementation/BackupImpl.java +++ b/sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/implementation/BackupImpl.java @@ -9,6 +9,7 @@ import com.azure.resourcemanager.netapp.fluent.models.BackupInner; import com.azure.resourcemanager.netapp.models.Backup; import com.azure.resourcemanager.netapp.models.BackupPatch; +import com.azure.resourcemanager.netapp.models.BackupType; import java.time.OffsetDateTime; import java.util.Map; @@ -53,7 +54,7 @@ public String label() { return this.innerModel().label(); } - public String backupType() { + public BackupType backupType() { return this.innerModel().backupType(); } @@ -65,6 +66,10 @@ public String volumeName() { return this.innerModel().volumeName(); } + public Boolean useExistingSnapshot() { + return this.innerModel().useExistingSnapshot(); + } + public Region region() { return Region.fromName(this.regionName()); } @@ -200,6 +205,16 @@ public BackupImpl withLabel(String label) { } } + public BackupImpl withUseExistingSnapshot(Boolean useExistingSnapshot) { + if (isInCreateMode()) { + this.innerModel().withUseExistingSnapshot(useExistingSnapshot); + return this; + } else { + this.updateBody.withUseExistingSnapshot(useExistingSnapshot); + return this; + } + } + public BackupImpl withTags(Map tags) { this.updateBody.withTags(tags); return this; diff --git a/sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/implementation/BackupPoliciesClientImpl.java b/sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/implementation/BackupPoliciesClientImpl.java index d1c22e7b10a9..b5710d52ad1d 100644 --- a/sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/implementation/BackupPoliciesClientImpl.java +++ b/sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/implementation/BackupPoliciesClientImpl.java @@ -123,7 +123,7 @@ Mono>> create( + "/netAppAccounts/{accountName}/backupPolicies/{backupPolicyName}") @ExpectedResponses({200, 202}) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> update( + Mono>> update( @HostParam("$host") String endpoint, @PathParam("subscriptionId") String subscriptionId, @PathParam("resourceGroupName") String resourceGroupName, @@ -198,7 +198,7 @@ private Mono> listSinglePageAsync(String resour res -> new PagedResponseBase<>( res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -364,7 +364,7 @@ private Mono> getWithResponseAsync( this.client.getApiVersion(), accept, context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -535,7 +535,7 @@ private Mono>> createWithResponseAsync( body, accept, context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -793,7 +793,7 @@ public BackupPolicyInner create( * @return backup policy information. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> updateWithResponseAsync( + private Mono>> updateWithResponseAsync( String resourceGroupName, String accountName, String backupPolicyName, BackupPolicyPatch body) { if (this.client.getEndpoint() == null) { return Mono @@ -838,7 +838,7 @@ private Mono> updateWithResponseAsync( body, accept, context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -855,7 +855,7 @@ private Mono> updateWithResponseAsync( * @return backup policy information. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> updateWithResponseAsync( + private Mono>> updateWithResponseAsync( String resourceGroupName, String accountName, String backupPolicyName, @@ -904,6 +904,99 @@ private Mono> updateWithResponseAsync( context); } + /** + * Patch a backup policy for Netapp Account. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account. + * @param backupPolicyName Backup policy Name which uniquely identify backup policy. + * @param body Backup policy object supplied in the body of the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return backup policy information. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, BackupPolicyInner> beginUpdateAsync( + String resourceGroupName, String accountName, String backupPolicyName, BackupPolicyPatch body) { + Mono>> mono = + updateWithResponseAsync(resourceGroupName, accountName, backupPolicyName, body); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), BackupPolicyInner.class, BackupPolicyInner.class, Context.NONE); + } + + /** + * Patch a backup policy for Netapp Account. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account. + * @param backupPolicyName Backup policy Name which uniquely identify backup policy. + * @param body Backup policy object supplied in the body of the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return backup policy information. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, BackupPolicyInner> beginUpdateAsync( + String resourceGroupName, + String accountName, + String backupPolicyName, + BackupPolicyPatch body, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + updateWithResponseAsync(resourceGroupName, accountName, backupPolicyName, body, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), BackupPolicyInner.class, BackupPolicyInner.class, context); + } + + /** + * Patch a backup policy for Netapp Account. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account. + * @param backupPolicyName Backup policy Name which uniquely identify backup policy. + * @param body Backup policy object supplied in the body of the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return backup policy information. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, BackupPolicyInner> beginUpdate( + String resourceGroupName, String accountName, String backupPolicyName, BackupPolicyPatch body) { + return beginUpdateAsync(resourceGroupName, accountName, backupPolicyName, body).getSyncPoller(); + } + + /** + * Patch a backup policy for Netapp Account. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account. + * @param backupPolicyName Backup policy Name which uniquely identify backup policy. + * @param body Backup policy object supplied in the body of the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return backup policy information. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, BackupPolicyInner> beginUpdate( + String resourceGroupName, + String accountName, + String backupPolicyName, + BackupPolicyPatch body, + Context context) { + return beginUpdateAsync(resourceGroupName, accountName, backupPolicyName, body, context).getSyncPoller(); + } + /** * Patch a backup policy for Netapp Account. * @@ -919,15 +1012,34 @@ private Mono> updateWithResponseAsync( @ServiceMethod(returns = ReturnType.SINGLE) private Mono updateAsync( String resourceGroupName, String accountName, String backupPolicyName, BackupPolicyPatch body) { - return updateWithResponseAsync(resourceGroupName, accountName, backupPolicyName, body) - .flatMap( - (Response res) -> { - if (res.getValue() != null) { - return Mono.just(res.getValue()); - } else { - return Mono.empty(); - } - }); + return beginUpdateAsync(resourceGroupName, accountName, backupPolicyName, body) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Patch a backup policy for Netapp Account. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account. + * @param backupPolicyName Backup policy Name which uniquely identify backup policy. + * @param body Backup policy object supplied in the body of the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return backup policy information. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, + String accountName, + String backupPolicyName, + BackupPolicyPatch body, + Context context) { + return beginUpdateAsync(resourceGroupName, accountName, backupPolicyName, body, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); } /** @@ -962,13 +1074,13 @@ public BackupPolicyInner update( * @return backup policy information. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response updateWithResponse( + public BackupPolicyInner update( String resourceGroupName, String accountName, String backupPolicyName, BackupPolicyPatch body, Context context) { - return updateWithResponseAsync(resourceGroupName, accountName, backupPolicyName, body, context).block(); + return updateAsync(resourceGroupName, accountName, backupPolicyName, body, context).block(); } /** @@ -1020,7 +1132,7 @@ private Mono>> deleteWithResponseAsync( backupPolicyName, this.client.getApiVersion(), context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** diff --git a/sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/implementation/BackupPolicyImpl.java b/sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/implementation/BackupPolicyImpl.java index ce1759820631..79a4b2c1a734 100644 --- a/sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/implementation/BackupPolicyImpl.java +++ b/sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/implementation/BackupPolicyImpl.java @@ -145,8 +145,7 @@ public BackupPolicy apply() { serviceManager .serviceClient() .getBackupPolicies() - .updateWithResponse(resourceGroupName, accountName, backupPolicyName, updateBody, Context.NONE) - .getValue(); + .update(resourceGroupName, accountName, backupPolicyName, updateBody, Context.NONE); return this; } @@ -155,8 +154,7 @@ public BackupPolicy apply(Context context) { serviceManager .serviceClient() .getBackupPolicies() - .updateWithResponse(resourceGroupName, accountName, backupPolicyName, updateBody, context) - .getValue(); + .update(resourceGroupName, accountName, backupPolicyName, updateBody, context); return this; } diff --git a/sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/implementation/BackupsClientImpl.java b/sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/implementation/BackupsClientImpl.java index 942642fb2a51..ef522294f18f 100644 --- a/sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/implementation/BackupsClientImpl.java +++ b/sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/implementation/BackupsClientImpl.java @@ -35,8 +35,9 @@ import com.azure.core.util.polling.SyncPoller; import com.azure.resourcemanager.netapp.fluent.BackupsClient; import com.azure.resourcemanager.netapp.fluent.models.BackupInner; -import com.azure.resourcemanager.netapp.fluent.models.BackupsListInner; +import com.azure.resourcemanager.netapp.fluent.models.BackupStatusInner; import com.azure.resourcemanager.netapp.models.BackupPatch; +import com.azure.resourcemanager.netapp.models.BackupsList; import java.nio.ByteBuffer; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; @@ -68,13 +69,30 @@ public final class BackupsClientImpl implements BackupsClient { @Host("{$host}") @ServiceInterface(name = "NetAppManagementClie") private interface BackupsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp" + + "/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/backupStatus") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getStatus( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("poolName") String poolName, + @PathParam("volumeName") String volumeName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + @Headers({"Content-Type: application/json"}) @Get( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp" + "/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/backups") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> list( + Mono> list( @HostParam("$host") String endpoint, @PathParam("subscriptionId") String subscriptionId, @PathParam("resourceGroupName") String resourceGroupName, @@ -159,6 +177,183 @@ Mono>> delete( Context context); } + /** + * Get the status of the backup for a volume. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account. + * @param poolName The name of the capacity pool. + * @param volumeName The name of the volume. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the status of the backup for a volume. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getStatusWithResponseAsync( + String resourceGroupName, String accountName, String poolName, String volumeName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (poolName == null) { + return Mono.error(new IllegalArgumentException("Parameter poolName is required and cannot be null.")); + } + if (volumeName == null) { + return Mono.error(new IllegalArgumentException("Parameter volumeName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getStatus( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + poolName, + volumeName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the status of the backup for a volume. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account. + * @param poolName The name of the capacity pool. + * @param volumeName The name of the volume. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the status of the backup for a volume. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getStatusWithResponseAsync( + String resourceGroupName, String accountName, String poolName, String volumeName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (poolName == null) { + return Mono.error(new IllegalArgumentException("Parameter poolName is required and cannot be null.")); + } + if (volumeName == null) { + return Mono.error(new IllegalArgumentException("Parameter volumeName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getStatus( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + poolName, + volumeName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Get the status of the backup for a volume. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account. + * @param poolName The name of the capacity pool. + * @param volumeName The name of the volume. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the status of the backup for a volume. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getStatusAsync( + String resourceGroupName, String accountName, String poolName, String volumeName) { + return getStatusWithResponseAsync(resourceGroupName, accountName, poolName, volumeName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get the status of the backup for a volume. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account. + * @param poolName The name of the capacity pool. + * @param volumeName The name of the volume. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the status of the backup for a volume. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public BackupStatusInner getStatus( + String resourceGroupName, String accountName, String poolName, String volumeName) { + return getStatusAsync(resourceGroupName, accountName, poolName, volumeName).block(); + } + + /** + * Get the status of the backup for a volume. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account. + * @param poolName The name of the capacity pool. + * @param volumeName The name of the volume. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the status of the backup for a volume. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getStatusWithResponse( + String resourceGroupName, String accountName, String poolName, String volumeName, Context context) { + return getStatusWithResponseAsync(resourceGroupName, accountName, poolName, volumeName, context).block(); + } + /** * List all backups for a volume. * @@ -218,7 +413,7 @@ private Mono> listSinglePageAsync( res -> new PagedResponseBase<>( res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -357,7 +552,7 @@ public PagedIterable list( } /** - * Get a particular backup of the volume. + * Gets the specified backup of the volume. * * @param resourceGroupName The name of the resource group. * @param accountName The name of the NetApp account. @@ -367,7 +562,7 @@ public PagedIterable list( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a particular backup of the volume. + * @return the specified backup of the volume. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> getWithResponseAsync( @@ -416,11 +611,11 @@ private Mono> getWithResponseAsync( this.client.getApiVersion(), accept, context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** - * Get a particular backup of the volume. + * Gets the specified backup of the volume. * * @param resourceGroupName The name of the resource group. * @param accountName The name of the NetApp account. @@ -431,7 +626,7 @@ private Mono> getWithResponseAsync( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a particular backup of the volume. + * @return the specified backup of the volume. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> getWithResponseAsync( @@ -486,7 +681,7 @@ private Mono> getWithResponseAsync( } /** - * Get a particular backup of the volume. + * Gets the specified backup of the volume. * * @param resourceGroupName The name of the resource group. * @param accountName The name of the NetApp account. @@ -496,7 +691,7 @@ private Mono> getWithResponseAsync( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a particular backup of the volume. + * @return the specified backup of the volume. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono getAsync( @@ -513,7 +708,7 @@ private Mono getAsync( } /** - * Get a particular backup of the volume. + * Gets the specified backup of the volume. * * @param resourceGroupName The name of the resource group. * @param accountName The name of the NetApp account. @@ -523,7 +718,7 @@ private Mono getAsync( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a particular backup of the volume. + * @return the specified backup of the volume. */ @ServiceMethod(returns = ReturnType.SINGLE) public BackupInner get( @@ -532,7 +727,7 @@ public BackupInner get( } /** - * Get a particular backup of the volume. + * Gets the specified backup of the volume. * * @param resourceGroupName The name of the resource group. * @param accountName The name of the NetApp account. @@ -543,7 +738,7 @@ public BackupInner get( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a particular backup of the volume. + * @return the specified backup of the volume. */ @ServiceMethod(returns = ReturnType.SINGLE) public Response getWithResponse( @@ -628,7 +823,7 @@ private Mono>> createWithResponseAsync( body, accept, context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -999,7 +1194,7 @@ private Mono>> updateWithResponseAsync( body, accept, context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -1398,7 +1593,7 @@ private Mono>> deleteWithResponseAsync( backupName, this.client.getApiVersion(), context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** diff --git a/sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/implementation/BackupsImpl.java b/sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/implementation/BackupsImpl.java index a8224593fc0d..d45cb30cc909 100644 --- a/sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/implementation/BackupsImpl.java +++ b/sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/implementation/BackupsImpl.java @@ -11,7 +11,9 @@ import com.azure.core.util.logging.ClientLogger; import com.azure.resourcemanager.netapp.fluent.BackupsClient; import com.azure.resourcemanager.netapp.fluent.models.BackupInner; +import com.azure.resourcemanager.netapp.fluent.models.BackupStatusInner; import com.azure.resourcemanager.netapp.models.Backup; +import com.azure.resourcemanager.netapp.models.BackupStatus; import com.azure.resourcemanager.netapp.models.Backups; import com.fasterxml.jackson.annotation.JsonIgnore; @@ -27,6 +29,30 @@ public BackupsImpl(BackupsClient innerClient, com.azure.resourcemanager.netapp.N this.serviceManager = serviceManager; } + public BackupStatus getStatus(String resourceGroupName, String accountName, String poolName, String volumeName) { + BackupStatusInner inner = this.serviceClient().getStatus(resourceGroupName, accountName, poolName, volumeName); + if (inner != null) { + return new BackupStatusImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getStatusWithResponse( + String resourceGroupName, String accountName, String poolName, String volumeName, Context context) { + Response inner = + this.serviceClient().getStatusWithResponse(resourceGroupName, accountName, poolName, volumeName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new BackupStatusImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + public PagedIterable list( String resourceGroupName, String accountName, String poolName, String volumeName) { PagedIterable inner = diff --git a/sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/implementation/BackupsListImpl.java b/sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/implementation/BackupsListImpl.java deleted file mode 100644 index b09e38e9feb7..000000000000 --- a/sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/implementation/BackupsListImpl.java +++ /dev/null @@ -1,43 +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.netapp.implementation; - -import com.azure.resourcemanager.netapp.fluent.models.BackupInner; -import com.azure.resourcemanager.netapp.fluent.models.BackupsListInner; -import com.azure.resourcemanager.netapp.models.Backup; -import com.azure.resourcemanager.netapp.models.BackupsList; -import java.util.Collections; -import java.util.List; -import java.util.stream.Collectors; - -public final class BackupsListImpl implements BackupsList { - private BackupsListInner innerObject; - - private final com.azure.resourcemanager.netapp.NetAppFilesManager serviceManager; - - BackupsListImpl(BackupsListInner innerObject, com.azure.resourcemanager.netapp.NetAppFilesManager serviceManager) { - this.innerObject = innerObject; - this.serviceManager = serviceManager; - } - - public List value() { - List inner = this.innerModel().value(); - if (inner != null) { - return Collections - .unmodifiableList( - inner.stream().map(inner1 -> new BackupImpl(inner1, this.manager())).collect(Collectors.toList())); - } else { - return Collections.emptyList(); - } - } - - public BackupsListInner innerModel() { - return this.innerObject; - } - - private com.azure.resourcemanager.netapp.NetAppFilesManager manager() { - return this.serviceManager; - } -} diff --git a/sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/implementation/NetAppManagementClientImpl.java b/sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/implementation/NetAppManagementClientImpl.java index 524e5e8e9427..8a1eb5bc6dfa 100644 --- a/sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/implementation/NetAppManagementClientImpl.java +++ b/sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/implementation/NetAppManagementClientImpl.java @@ -32,7 +32,6 @@ import com.azure.resourcemanager.netapp.fluent.SnapshotPoliciesClient; import com.azure.resourcemanager.netapp.fluent.SnapshotsClient; import com.azure.resourcemanager.netapp.fluent.VaultsClient; -import com.azure.resourcemanager.netapp.fluent.VolumeBackupStatusClient; import com.azure.resourcemanager.netapp.fluent.VolumesClient; import java.io.IOException; import java.lang.reflect.Type; @@ -209,16 +208,16 @@ public SnapshotPoliciesClient getSnapshotPolicies() { return this.snapshotPolicies; } - /** The VolumeBackupStatusClient object to access its operations. */ - private final VolumeBackupStatusClient volumeBackupStatus; + /** The BackupsClient object to access its operations. */ + private final BackupsClient backups; /** - * Gets the VolumeBackupStatusClient object to access its operations. + * Gets the BackupsClient object to access its operations. * - * @return the VolumeBackupStatusClient object. + * @return the BackupsClient object. */ - public VolumeBackupStatusClient getVolumeBackupStatus() { - return this.volumeBackupStatus; + public BackupsClient getBackups() { + return this.backups; } /** The AccountBackupsClient object to access its operations. */ @@ -233,18 +232,6 @@ public AccountBackupsClient getAccountBackups() { return this.accountBackups; } - /** The BackupsClient object to access its operations. */ - private final BackupsClient backups; - - /** - * Gets the BackupsClient object to access its operations. - * - * @return the BackupsClient object. - */ - public BackupsClient getBackups() { - return this.backups; - } - /** The BackupPoliciesClient object to access its operations. */ private final BackupPoliciesClient backupPolicies; @@ -292,7 +279,7 @@ public VaultsClient getVaults() { this.defaultPollInterval = defaultPollInterval; this.subscriptionId = subscriptionId; this.endpoint = endpoint; - this.apiVersion = "2020-12-01"; + this.apiVersion = "2021-02-01"; this.operations = new OperationsClientImpl(this); this.netAppResources = new NetAppResourcesClientImpl(this); this.accounts = new AccountsClientImpl(this); @@ -300,9 +287,8 @@ public VaultsClient getVaults() { this.volumes = new VolumesClientImpl(this); this.snapshots = new SnapshotsClientImpl(this); this.snapshotPolicies = new SnapshotPoliciesClientImpl(this); - this.volumeBackupStatus = new VolumeBackupStatusClientImpl(this); - this.accountBackups = new AccountBackupsClientImpl(this); this.backups = new BackupsClientImpl(this); + this.accountBackups = new AccountBackupsClientImpl(this); this.backupPolicies = new BackupPoliciesClientImpl(this); this.vaults = new VaultsClientImpl(this); } diff --git a/sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/implementation/NetAppResourcesClientImpl.java b/sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/implementation/NetAppResourcesClientImpl.java index 30034fde3a9e..812af125c27b 100644 --- a/sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/implementation/NetAppResourcesClientImpl.java +++ b/sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/implementation/NetAppResourcesClientImpl.java @@ -144,7 +144,7 @@ private Mono> checkNameAvailabilityWith body, accept, context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -296,7 +296,7 @@ private Mono> checkFilePathAvailability body, accept, context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -449,7 +449,7 @@ private Mono> checkQuotaAvailabilityWit body, accept, context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** diff --git a/sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/implementation/OperationsClientImpl.java b/sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/implementation/OperationsClientImpl.java index 3366f8a70ea6..3c181be6098f 100644 --- a/sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/implementation/OperationsClientImpl.java +++ b/sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/implementation/OperationsClientImpl.java @@ -92,7 +92,7 @@ private Mono> listSinglePageAsync() { res -> new PagedResponseBase<>( res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** diff --git a/sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/implementation/PoolsClientImpl.java b/sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/implementation/PoolsClientImpl.java index 109067d6979e..435bfed7cce3 100644 --- a/sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/implementation/PoolsClientImpl.java +++ b/sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/implementation/PoolsClientImpl.java @@ -212,7 +212,7 @@ private Mono> listSinglePageAsync(String resour res.getValue().value(), res.getValue().nextLink(), null)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -385,7 +385,7 @@ private Mono> getWithResponseAsync( this.client.getApiVersion(), accept, context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -554,7 +554,7 @@ private Mono>> createOrUpdateWithResponseAsync( body, accept, context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -835,7 +835,7 @@ private Mono>> updateWithResponseAsync( body, accept, context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -1106,7 +1106,7 @@ private Mono>> deleteWithResponseAsync( poolName, this.client.getApiVersion(), context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -1336,7 +1336,7 @@ private Mono> listNextSinglePageAsync(String ne res.getValue().value(), res.getValue().nextLink(), null)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** diff --git a/sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/implementation/SnapshotPoliciesClientImpl.java b/sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/implementation/SnapshotPoliciesClientImpl.java index 16263cbfb727..be5a2ac5a9db 100644 --- a/sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/implementation/SnapshotPoliciesClientImpl.java +++ b/sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/implementation/SnapshotPoliciesClientImpl.java @@ -215,7 +215,7 @@ private Mono> listSinglePageAsync(String reso res -> new PagedResponseBase<>( res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -381,7 +381,7 @@ private Mono> getWithResponseAsync( this.client.getApiVersion(), accept, context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -553,7 +553,7 @@ private Mono> createWithResponseAsync( body, accept, context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -744,7 +744,7 @@ private Mono>> updateWithResponseAsync( body, accept, context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -1042,7 +1042,7 @@ private Mono>> deleteWithResponseAsync( snapshotPolicyName, this.client.getApiVersion(), context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -1294,7 +1294,7 @@ private Mono> listVolumesWithResponseAsy this.client.getApiVersion(), accept, context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** diff --git a/sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/implementation/SnapshotsClientImpl.java b/sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/implementation/SnapshotsClientImpl.java index d42263b4832f..3d8f81137e5e 100644 --- a/sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/implementation/SnapshotsClientImpl.java +++ b/sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/implementation/SnapshotsClientImpl.java @@ -222,7 +222,7 @@ private Mono> listSinglePageAsync( res -> new PagedResponseBase<>( res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -420,7 +420,7 @@ private Mono> getWithResponseAsync( this.client.getApiVersion(), accept, context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -633,7 +633,7 @@ private Mono>> createWithResponseAsync( body, accept, context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -1005,7 +1005,7 @@ private Mono>> updateWithResponseAsync( body, accept, context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -1363,7 +1363,7 @@ private Mono>> deleteWithResponseAsync( snapshotName, this.client.getApiVersion(), context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** diff --git a/sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/implementation/VaultsClientImpl.java b/sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/implementation/VaultsClientImpl.java index ba690401012f..dcbf07947b0d 100644 --- a/sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/implementation/VaultsClientImpl.java +++ b/sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/implementation/VaultsClientImpl.java @@ -122,7 +122,7 @@ private Mono> listSinglePageAsync(String resourceGroup res -> new PagedResponseBase<>( res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** diff --git a/sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/implementation/VolumeBackupStatusClientImpl.java b/sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/implementation/VolumeBackupStatusClientImpl.java deleted file mode 100644 index 9bb9baf79ce7..000000000000 --- a/sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/implementation/VolumeBackupStatusClientImpl.java +++ /dev/null @@ -1,250 +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.netapp.implementation; - -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.Get; -import com.azure.core.annotation.HeaderParam; -import com.azure.core.annotation.Headers; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.PathParam; -import com.azure.core.annotation.QueryParam; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.RestProxy; -import com.azure.core.management.exception.ManagementException; -import com.azure.core.util.Context; -import com.azure.core.util.FluxUtil; -import com.azure.core.util.logging.ClientLogger; -import com.azure.resourcemanager.netapp.fluent.VolumeBackupStatusClient; -import com.azure.resourcemanager.netapp.fluent.models.BackupStatusInner; -import reactor.core.publisher.Mono; - -/** An instance of this class provides access to all the operations defined in VolumeBackupStatusClient. */ -public final class VolumeBackupStatusClientImpl implements VolumeBackupStatusClient { - private final ClientLogger logger = new ClientLogger(VolumeBackupStatusClientImpl.class); - - /** The proxy service used to perform REST calls. */ - private final VolumeBackupStatusService service; - - /** The service client containing this operation class. */ - private final NetAppManagementClientImpl client; - - /** - * Initializes an instance of VolumeBackupStatusClientImpl. - * - * @param client the instance of the service client containing this operation class. - */ - VolumeBackupStatusClientImpl(NetAppManagementClientImpl client) { - this.service = - RestProxy.create(VolumeBackupStatusService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for NetAppManagementClientVolumeBackupStatus to be used by the proxy - * service to perform REST calls. - */ - @Host("{$host}") - @ServiceInterface(name = "NetAppManagementClie") - private interface VolumeBackupStatusService { - @Headers({"Content-Type: application/json"}) - @Get( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp" - + "/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/backupStatus") - @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> get( - @HostParam("$host") String endpoint, - @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, - @PathParam("accountName") String accountName, - @PathParam("poolName") String poolName, - @PathParam("volumeName") String volumeName, - @QueryParam("api-version") String apiVersion, - @HeaderParam("Accept") String accept, - Context context); - } - - /** - * Get the status of the backup for a volume. - * - * @param resourceGroupName The name of the resource group. - * @param accountName The name of the NetApp account. - * @param poolName The name of the capacity pool. - * @param volumeName The name of the volume. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the status of the backup for a volume. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getWithResponseAsync( - String resourceGroupName, String accountName, String poolName, String volumeName) { - if (this.client.getEndpoint() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (accountName == null) { - return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); - } - if (poolName == null) { - return Mono.error(new IllegalArgumentException("Parameter poolName is required and cannot be null.")); - } - if (volumeName == null) { - return Mono.error(new IllegalArgumentException("Parameter volumeName is required and cannot be null.")); - } - final String accept = "application/json"; - return FluxUtil - .withContext( - context -> - service - .get( - this.client.getEndpoint(), - this.client.getSubscriptionId(), - resourceGroupName, - accountName, - poolName, - volumeName, - this.client.getApiVersion(), - accept, - context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); - } - - /** - * Get the status of the backup for a volume. - * - * @param resourceGroupName The name of the resource group. - * @param accountName The name of the NetApp account. - * @param poolName The name of the capacity pool. - * @param volumeName The name of the volume. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the status of the backup for a volume. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getWithResponseAsync( - String resourceGroupName, String accountName, String poolName, String volumeName, Context context) { - if (this.client.getEndpoint() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (accountName == null) { - return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); - } - if (poolName == null) { - return Mono.error(new IllegalArgumentException("Parameter poolName is required and cannot be null.")); - } - if (volumeName == null) { - return Mono.error(new IllegalArgumentException("Parameter volumeName is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service - .get( - this.client.getEndpoint(), - this.client.getSubscriptionId(), - resourceGroupName, - accountName, - poolName, - volumeName, - this.client.getApiVersion(), - accept, - context); - } - - /** - * Get the status of the backup for a volume. - * - * @param resourceGroupName The name of the resource group. - * @param accountName The name of the NetApp account. - * @param poolName The name of the capacity pool. - * @param volumeName The name of the volume. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the status of the backup for a volume. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono getAsync( - String resourceGroupName, String accountName, String poolName, String volumeName) { - return getWithResponseAsync(resourceGroupName, accountName, poolName, volumeName) - .flatMap( - (Response res) -> { - if (res.getValue() != null) { - return Mono.just(res.getValue()); - } else { - return Mono.empty(); - } - }); - } - - /** - * Get the status of the backup for a volume. - * - * @param resourceGroupName The name of the resource group. - * @param accountName The name of the NetApp account. - * @param poolName The name of the capacity pool. - * @param volumeName The name of the volume. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the status of the backup for a volume. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public BackupStatusInner get(String resourceGroupName, String accountName, String poolName, String volumeName) { - return getAsync(resourceGroupName, accountName, poolName, volumeName).block(); - } - - /** - * Get the status of the backup for a volume. - * - * @param resourceGroupName The name of the resource group. - * @param accountName The name of the NetApp account. - * @param poolName The name of the capacity pool. - * @param volumeName The name of the volume. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the status of the backup for a volume. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse( - String resourceGroupName, String accountName, String poolName, String volumeName, Context context) { - return getWithResponseAsync(resourceGroupName, accountName, poolName, volumeName, context).block(); - } -} diff --git a/sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/implementation/VolumeBackupStatusImpl.java b/sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/implementation/VolumeBackupStatusImpl.java deleted file mode 100644 index 18daf12ad18d..000000000000 --- a/sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/implementation/VolumeBackupStatusImpl.java +++ /dev/null @@ -1,61 +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.netapp.implementation; - -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.SimpleResponse; -import com.azure.core.util.Context; -import com.azure.core.util.logging.ClientLogger; -import com.azure.resourcemanager.netapp.fluent.VolumeBackupStatusClient; -import com.azure.resourcemanager.netapp.fluent.models.BackupStatusInner; -import com.azure.resourcemanager.netapp.models.BackupStatus; -import com.azure.resourcemanager.netapp.models.VolumeBackupStatus; -import com.fasterxml.jackson.annotation.JsonIgnore; - -public final class VolumeBackupStatusImpl implements VolumeBackupStatus { - @JsonIgnore private final ClientLogger logger = new ClientLogger(VolumeBackupStatusImpl.class); - - private final VolumeBackupStatusClient innerClient; - - private final com.azure.resourcemanager.netapp.NetAppFilesManager serviceManager; - - public VolumeBackupStatusImpl( - VolumeBackupStatusClient innerClient, com.azure.resourcemanager.netapp.NetAppFilesManager serviceManager) { - this.innerClient = innerClient; - this.serviceManager = serviceManager; - } - - public BackupStatus get(String resourceGroupName, String accountName, String poolName, String volumeName) { - BackupStatusInner inner = this.serviceClient().get(resourceGroupName, accountName, poolName, volumeName); - if (inner != null) { - return new BackupStatusImpl(inner, this.manager()); - } else { - return null; - } - } - - public Response getWithResponse( - String resourceGroupName, String accountName, String poolName, String volumeName, Context context) { - Response inner = - this.serviceClient().getWithResponse(resourceGroupName, accountName, poolName, volumeName, context); - if (inner != null) { - return new SimpleResponse<>( - inner.getRequest(), - inner.getStatusCode(), - inner.getHeaders(), - new BackupStatusImpl(inner.getValue(), this.manager())); - } else { - return null; - } - } - - private VolumeBackupStatusClient serviceClient() { - return this.innerClient; - } - - private com.azure.resourcemanager.netapp.NetAppFilesManager manager() { - return this.serviceManager; - } -} diff --git a/sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/implementation/VolumesClientImpl.java b/sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/implementation/VolumesClientImpl.java index ace1a81d17a4..f131c2b687f4 100644 --- a/sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/implementation/VolumesClientImpl.java +++ b/sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/implementation/VolumesClientImpl.java @@ -362,7 +362,7 @@ private Mono> listSinglePageAsync( res.getValue().value(), res.getValue().nextLink(), null)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -552,7 +552,7 @@ private Mono> getWithResponseAsync( this.client.getApiVersion(), accept, context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -735,7 +735,7 @@ private Mono>> createOrUpdateWithResponseAsync( body, accept, context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -1060,7 +1060,7 @@ private Mono>> updateWithResponseAsync( body, accept, context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -1375,7 +1375,7 @@ private Mono>> deleteWithResponseAsync( volumeName, this.client.getApiVersion(), context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -1649,7 +1649,7 @@ private Mono>> revertWithResponseAsync( this.client.getApiVersion(), body, context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -1967,7 +1967,7 @@ private Mono>> breakReplicationWithResponseAsync( this.client.getApiVersion(), body, context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -2331,7 +2331,7 @@ private Mono> replicationStatusWithResponseAsyn this.client.getApiVersion(), accept, context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -2508,7 +2508,7 @@ private Mono>> resyncReplicationWithResponseAsync( volumeName, this.client.getApiVersion(), context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -2786,7 +2786,7 @@ private Mono>> deleteReplicationWithResponseAsync( volumeName, this.client.getApiVersion(), context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -3062,7 +3062,7 @@ private Mono>> authorizeReplicationWithResponseAsync( this.client.getApiVersion(), body, context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -3373,7 +3373,7 @@ private Mono>> reInitializeReplicationWithResponseAsyn volumeName, this.client.getApiVersion(), context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -3650,7 +3650,7 @@ private Mono>> poolChangeWithResponseAsync( this.client.getApiVersion(), body, context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -3939,7 +3939,7 @@ private Mono> listNextSinglePageAsync(String nextLink res.getValue().value(), res.getValue().nextLink(), null)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** diff --git a/sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/models/AccountBackups.java b/sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/models/AccountBackups.java index 0c8933176f17..2142e002b409 100644 --- a/sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/models/AccountBackups.java +++ b/sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/models/AccountBackups.java @@ -4,6 +4,7 @@ package com.azure.resourcemanager.netapp.models; +import com.azure.core.http.rest.PagedIterable; import com.azure.core.http.rest.Response; import com.azure.core.util.Context; @@ -19,7 +20,7 @@ public interface AccountBackups { * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return list of Backups. */ - BackupsList list(String resourceGroupName, String accountName); + PagedIterable list(String resourceGroupName, String accountName); /** * List all Backups for a Netapp Account. @@ -32,10 +33,10 @@ public interface AccountBackups { * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return list of Backups. */ - Response listWithResponse(String resourceGroupName, String accountName, Context context); + PagedIterable list(String resourceGroupName, String accountName, Context context); /** - * Get Backup for a Netapp Account. + * Gets the specified backup for a Netapp Account. * * @param resourceGroupName The name of the resource group. * @param accountName The name of the NetApp account. @@ -43,12 +44,12 @@ public interface AccountBackups { * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return backup for a Netapp Account. + * @return the specified backup for a Netapp Account. */ Backup get(String resourceGroupName, String accountName, String backupName); /** - * Get Backup for a Netapp Account. + * Gets the specified backup for a Netapp Account. * * @param resourceGroupName The name of the resource group. * @param accountName The name of the NetApp account. @@ -57,12 +58,12 @@ public interface AccountBackups { * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return backup for a Netapp Account. + * @return the specified backup for a Netapp Account. */ Response getWithResponse(String resourceGroupName, String accountName, String backupName, Context context); /** - * Delete Backup for a Netapp Account. + * Delete the specified Backup for a Netapp Account. * * @param resourceGroupName The name of the resource group. * @param accountName The name of the NetApp account. @@ -74,7 +75,7 @@ public interface AccountBackups { void delete(String resourceGroupName, String accountName, String backupName); /** - * Delete Backup for a Netapp Account. + * Delete the specified Backup for a Netapp Account. * * @param resourceGroupName The name of the resource group. * @param accountName The name of the NetApp account. diff --git a/sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/models/Backup.java b/sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/models/Backup.java index 94944beb7330..3c8dc8d95ff0 100644 --- a/sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/models/Backup.java +++ b/sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/models/Backup.java @@ -76,11 +76,11 @@ public interface Backup { String label(); /** - * Gets the backupType property: Type of backup adhoc or scheduled. + * Gets the backupType property: Type of backup Manual or Scheduled. * * @return the backupType value. */ - String backupType(); + BackupType backupType(); /** * Gets the failureReason property: Failure reason. @@ -96,6 +96,14 @@ public interface Backup { */ String volumeName(); + /** + * Gets the useExistingSnapshot property: Manual backup an already existing snapshot. This will always be false for + * scheduled backups and true/false for manual backups. + * + * @return the useExistingSnapshot value. + */ + Boolean useExistingSnapshot(); + /** * Gets the region of the resource. * @@ -165,7 +173,7 @@ WithCreate withExistingVolume( * The stage of the Backup definition which contains all the minimum required properties for the resource to be * created, but also allows for any other optional properties to be specified. */ - interface WithCreate extends DefinitionStages.WithLabel { + interface WithCreate extends DefinitionStages.WithLabel, DefinitionStages.WithUseExistingSnapshot { /** * Executes the create request. * @@ -191,6 +199,18 @@ interface WithLabel { */ WithCreate withLabel(String label); } + /** The stage of the Backup definition allowing to specify useExistingSnapshot. */ + interface WithUseExistingSnapshot { + /** + * Specifies the useExistingSnapshot property: Manual backup an already existing snapshot. This will always + * be false for scheduled backups and true/false for manual backups. + * + * @param useExistingSnapshot Manual backup an already existing snapshot. This will always be false for + * scheduled backups and true/false for manual backups. + * @return the next definition stage. + */ + WithCreate withUseExistingSnapshot(Boolean useExistingSnapshot); + } } /** * Begins update for the Backup resource. @@ -200,7 +220,7 @@ interface WithLabel { Backup.Update update(); /** The template for Backup update. */ - interface Update extends UpdateStages.WithTags, UpdateStages.WithLabel { + interface Update extends UpdateStages.WithTags, UpdateStages.WithLabel, UpdateStages.WithUseExistingSnapshot { /** * Executes the update request. * @@ -238,6 +258,18 @@ interface WithLabel { */ Update withLabel(String label); } + /** The stage of the Backup update allowing to specify useExistingSnapshot. */ + interface WithUseExistingSnapshot { + /** + * Specifies the useExistingSnapshot property: Manual backup an already existing snapshot. This will always + * be false for scheduled backups and true/false for manual backups. + * + * @param useExistingSnapshot Manual backup an already existing snapshot. This will always be false for + * scheduled backups and true/false for manual backups. + * @return the next definition stage. + */ + Update withUseExistingSnapshot(Boolean useExistingSnapshot); + } } /** * Refreshes the resource to sync with Azure. diff --git a/sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/models/BackupPatch.java b/sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/models/BackupPatch.java index f547e121565e..c7d8d804fc54 100644 --- a/sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/models/BackupPatch.java +++ b/sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/models/BackupPatch.java @@ -55,10 +55,10 @@ public class BackupPatch { private String label; /* - * Type of backup adhoc or scheduled + * Type of backup Manual or Scheduled */ @JsonProperty(value = "properties.backupType", access = JsonProperty.Access.WRITE_ONLY) - private String backupType; + private BackupType backupType; /* * Failure reason @@ -72,6 +72,13 @@ public class BackupPatch { @JsonProperty(value = "properties.volumeName", access = JsonProperty.Access.WRITE_ONLY) private String volumeName; + /* + * Manual backup an already existing snapshot. This will always be false + * for scheduled backups and true/false for manual backups + */ + @JsonProperty(value = "properties.useExistingSnapshot") + private Boolean useExistingSnapshot; + /** * Get the tags property: Resource tags. * @@ -149,11 +156,11 @@ public BackupPatch withLabel(String label) { } /** - * Get the backupType property: Type of backup adhoc or scheduled. + * Get the backupType property: Type of backup Manual or Scheduled. * * @return the backupType value. */ - public String backupType() { + public BackupType backupType() { return this.backupType; } @@ -175,6 +182,28 @@ public String volumeName() { return this.volumeName; } + /** + * Get the useExistingSnapshot property: Manual backup an already existing snapshot. This will always be false for + * scheduled backups and true/false for manual backups. + * + * @return the useExistingSnapshot value. + */ + public Boolean useExistingSnapshot() { + return this.useExistingSnapshot; + } + + /** + * Set the useExistingSnapshot property: Manual backup an already existing snapshot. This will always be false for + * scheduled backups and true/false for manual backups. + * + * @param useExistingSnapshot the useExistingSnapshot value to set. + * @return the BackupPatch object itself. + */ + public BackupPatch withUseExistingSnapshot(Boolean useExistingSnapshot) { + this.useExistingSnapshot = useExistingSnapshot; + return this; + } + /** * Validates the instance. * diff --git a/sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/models/BackupType.java b/sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/models/BackupType.java new file mode 100644 index 000000000000..f8ebe45eb876 --- /dev/null +++ b/sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/models/BackupType.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.netapp.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for BackupType. */ +public final class BackupType extends ExpandableStringEnum { + /** Static value Manual for BackupType. */ + public static final BackupType MANUAL = fromString("Manual"); + + /** Static value Scheduled for BackupType. */ + public static final BackupType SCHEDULED = fromString("Scheduled"); + + /** + * Creates or finds a BackupType from its string representation. + * + * @param name a name to look for. + * @return the corresponding BackupType. + */ + @JsonCreator + public static BackupType fromString(String name) { + return fromString(name, BackupType.class); + } + + /** @return known BackupType values. */ + public static Collection values() { + return values(BackupType.class); + } +} diff --git a/sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/models/Backups.java b/sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/models/Backups.java index 13464a8e42d8..808e5586a9e5 100644 --- a/sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/models/Backups.java +++ b/sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/models/Backups.java @@ -10,6 +10,36 @@ /** Resource collection API of Backups. */ public interface Backups { + /** + * Get the status of the backup for a volume. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account. + * @param poolName The name of the capacity pool. + * @param volumeName The name of the volume. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the status of the backup for a volume. + */ + BackupStatus getStatus(String resourceGroupName, String accountName, String poolName, String volumeName); + + /** + * Get the status of the backup for a volume. + * + * @param resourceGroupName The name of the resource group. + * @param accountName The name of the NetApp account. + * @param poolName The name of the capacity pool. + * @param volumeName The name of the volume. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the status of the backup for a volume. + */ + Response getStatusWithResponse( + String resourceGroupName, String accountName, String poolName, String volumeName, Context context); + /** * List all backups for a volume. * @@ -41,7 +71,7 @@ PagedIterable list( String resourceGroupName, String accountName, String poolName, String volumeName, Context context); /** - * Get a particular backup of the volume. + * Gets the specified backup of the volume. * * @param resourceGroupName The name of the resource group. * @param accountName The name of the NetApp account. @@ -51,12 +81,12 @@ PagedIterable list( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a particular backup of the volume. + * @return the specified backup of the volume. */ Backup get(String resourceGroupName, String accountName, String poolName, String volumeName, String backupName); /** - * Get a particular backup of the volume. + * Gets the specified backup of the volume. * * @param resourceGroupName The name of the resource group. * @param accountName The name of the NetApp account. @@ -67,7 +97,7 @@ PagedIterable list( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a particular backup of the volume. + * @return the specified backup of the volume. */ Response getWithResponse( String resourceGroupName, @@ -113,25 +143,25 @@ void delete( Context context); /** - * Get a particular backup of the volume. + * Gets the specified backup of the volume. * * @param id the resource ID. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a particular backup of the volume. + * @return the specified backup of the volume. */ Backup getById(String id); /** - * Get a particular backup of the volume. + * Gets the specified backup of the volume. * * @param id the resource ID. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a particular backup of the volume. + * @return the specified backup of the volume. */ Response getByIdWithResponse(String id, Context context); diff --git a/sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/models/BackupsList.java b/sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/models/BackupsList.java index ede826ff2169..0b6696a5dd6b 100644 --- a/sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/models/BackupsList.java +++ b/sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/models/BackupsList.java @@ -4,22 +4,52 @@ package com.azure.resourcemanager.netapp.models; -import com.azure.resourcemanager.netapp.fluent.models.BackupsListInner; +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.netapp.fluent.models.BackupInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; import java.util.List; -/** An immutable client-side representation of BackupsList. */ -public interface BackupsList { +/** List of Backups. */ +@Fluent +public final class BackupsList { + @JsonIgnore private final ClientLogger logger = new ClientLogger(BackupsList.class); + + /* + * A list of Backups + */ + @JsonProperty(value = "value") + private List value; + /** - * Gets the value property: A list of Backups. + * Get the value property: A list of Backups. * * @return the value value. */ - List value(); + public List value() { + return this.value; + } + + /** + * Set the value property: A list of Backups. + * + * @param value the value value to set. + * @return the BackupsList object itself. + */ + public BackupsList withValue(List value) { + this.value = value; + return this; + } /** - * Gets the inner com.azure.resourcemanager.netapp.fluent.models.BackupsListInner object. + * Validates the instance. * - * @return the inner object. + * @throws IllegalArgumentException thrown if the instance is not valid. */ - BackupsListInner innerModel(); + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } } diff --git a/sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/models/Volume.java b/sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/models/Volume.java index e95a327f4a72..0c8b5a158d23 100644 --- a/sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/models/Volume.java +++ b/sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/models/Volume.java @@ -84,7 +84,7 @@ public interface Volume { VolumePropertiesExportPolicy exportPolicy(); /** - * Gets the protocolTypes property: Set of protocol types, default NFSv3, CIFS fro SMB protocol. + * Gets the protocolTypes property: Set of protocol types, default NFSv3, CIFS for SMB protocol. * * @return the protocolTypes value. */ @@ -387,9 +387,9 @@ interface WithExportPolicy { /** The stage of the Volume definition allowing to specify protocolTypes. */ interface WithProtocolTypes { /** - * Specifies the protocolTypes property: Set of protocol types, default NFSv3, CIFS fro SMB protocol. + * Specifies the protocolTypes property: Set of protocol types, default NFSv3, CIFS for SMB protocol. * - * @param protocolTypes Set of protocol types, default NFSv3, CIFS fro SMB protocol. + * @param protocolTypes Set of protocol types, default NFSv3, CIFS for SMB protocol. * @return the next definition stage. */ WithCreate withProtocolTypes(List protocolTypes); diff --git a/sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/models/VolumeBackupStatus.java b/sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/models/VolumeBackupStatus.java deleted file mode 100644 index ced98c3ab435..000000000000 --- a/sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/models/VolumeBackupStatus.java +++ /dev/null @@ -1,41 +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.netapp.models; - -import com.azure.core.http.rest.Response; -import com.azure.core.util.Context; - -/** Resource collection API of VolumeBackupStatus. */ -public interface VolumeBackupStatus { - /** - * Get the status of the backup for a volume. - * - * @param resourceGroupName The name of the resource group. - * @param accountName The name of the NetApp account. - * @param poolName The name of the capacity pool. - * @param volumeName The name of the volume. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the status of the backup for a volume. - */ - BackupStatus get(String resourceGroupName, String accountName, String poolName, String volumeName); - - /** - * Get the status of the backup for a volume. - * - * @param resourceGroupName The name of the resource group. - * @param accountName The name of the NetApp account. - * @param poolName The name of the capacity pool. - * @param volumeName The name of the volume. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the status of the backup for a volume. - */ - Response getWithResponse( - String resourceGroupName, String accountName, String poolName, String volumeName, Context context); -} diff --git a/sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/models/VolumePatchPropertiesDataProtection.java b/sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/models/VolumePatchPropertiesDataProtection.java index 45ec38466bf7..40ae37f386dd 100644 --- a/sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/models/VolumePatchPropertiesDataProtection.java +++ b/sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/models/VolumePatchPropertiesDataProtection.java @@ -20,6 +20,12 @@ public final class VolumePatchPropertiesDataProtection { @JsonProperty(value = "backup") private VolumeBackupProperties backup; + /* + * Snapshot properties. + */ + @JsonProperty(value = "snapshot") + private VolumeSnapshotProperties snapshot; + /** * Get the backup property: Backup Properties. * @@ -40,6 +46,26 @@ public VolumePatchPropertiesDataProtection withBackup(VolumeBackupProperties bac return this; } + /** + * Get the snapshot property: Snapshot properties. + * + * @return the snapshot value. + */ + public VolumeSnapshotProperties snapshot() { + return this.snapshot; + } + + /** + * Set the snapshot property: Snapshot properties. + * + * @param snapshot the snapshot value to set. + * @return the VolumePatchPropertiesDataProtection object itself. + */ + public VolumePatchPropertiesDataProtection withSnapshot(VolumeSnapshotProperties snapshot) { + this.snapshot = snapshot; + return this; + } + /** * Validates the instance. * @@ -49,5 +75,8 @@ public void validate() { if (backup() != null) { backup().validate(); } + if (snapshot() != null) { + snapshot().validate(); + } } }