diff --git a/sdk/storagecache/azure-resourcemanager-storagecache/CHANGELOG.md b/sdk/storagecache/azure-resourcemanager-storagecache/CHANGELOG.md index 72be429306f6..578540d8dc79 100644 --- a/sdk/storagecache/azure-resourcemanager-storagecache/CHANGELOG.md +++ b/sdk/storagecache/azure-resourcemanager-storagecache/CHANGELOG.md @@ -1,7 +1,8 @@ # Release History -## 1.0.0-beta.3 (Unreleased) +## 1.0.0-beta.1 (2021-07-29) +- Azure Resource Manager StorageCache client library for Java. This package contains Microsoft Azure SDK for StorageCache Management SDK. A Storage Cache provides scalable caching service for NAS clients, serving data from either NFSv3 or Blob at-rest storage (referred to as "Storage Targets"). These operations allow you to manage Caches. Package tag package-2021-05. 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-08) diff --git a/sdk/storagecache/azure-resourcemanager-storagecache/README.md b/sdk/storagecache/azure-resourcemanager-storagecache/README.md index 4b94ae8cb0a1..60b78af73c5b 100644 --- a/sdk/storagecache/azure-resourcemanager-storagecache/README.md +++ b/sdk/storagecache/azure-resourcemanager-storagecache/README.md @@ -2,7 +2,7 @@ Azure Resource Manager StorageCache client library for Java. -This package contains Microsoft Azure SDK for StorageCache Management SDK. A Storage Cache provides scalable caching service for NAS clients, serving data from either NFSv3 or Blob at-rest storage (referred to as "Storage Targets"). These operations allow you to manage Caches. Package tag package-2021-03. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). +This package contains Microsoft Azure SDK for StorageCache Management SDK. A Storage Cache provides scalable caching service for NAS clients, serving data from either NFSv3 or Blob at-rest storage (referred to as "Storage Targets"). These operations allow you to manage Caches. Package tag package-2021-05. 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-storagecache - 1.0.0-beta.2 + 1.0.0-beta.3 ``` [//]: # ({x-version-update-end}) @@ -74,6 +74,8 @@ See [API design][design] for general introduction on design and key concepts on ## Examples + + ## Troubleshooting ## Next steps diff --git a/sdk/storagecache/azure-resourcemanager-storagecache/pom.xml b/sdk/storagecache/azure-resourcemanager-storagecache/pom.xml index 106898d6122d..606b007a9877 100644 --- a/sdk/storagecache/azure-resourcemanager-storagecache/pom.xml +++ b/sdk/storagecache/azure-resourcemanager-storagecache/pom.xml @@ -1,67 +1,86 @@ - 4.0.0 - - com.azure - azure-client-sdk-parent - 1.7.0 - ../../parents/azure-client-sdk-parent - + 4.0.0 + + com.azure + azure-client-sdk-parent + 1.7.0 + ../../parents/azure-client-sdk-parent + - com.azure.resourcemanager - azure-resourcemanager-storagecache - 1.0.0-beta.3 - jar + com.azure.resourcemanager + azure-resourcemanager-storagecache + 1.0.0-beta.3 + jar - Microsoft Azure SDK for StorageCache Management - This package contains Microsoft Azure SDK for StorageCache Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. A Storage Cache provides scalable caching service for NAS clients, serving data from either NFSv3 or Blob at-rest storage (referred to as "Storage Targets"). These operations allow you to manage Caches. Package tag package-2021-03. - https://github.com/Azure/azure-sdk-for-java + Microsoft Azure SDK for StorageCache Management + This package contains Microsoft Azure SDK for StorageCache Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. A Storage Cache provides scalable caching service for NAS clients, serving data from either NFSv3 or Blob at-rest storage (referred to as "Storage Targets"). These operations allow you to manage Caches. Package tag package-2021-05. + https://github.com/Azure/azure-sdk-for-java - - - The MIT License (MIT) - http://opensource.org/licenses/MIT - repo - - + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + - - https://github.com/Azure/azure-sdk-for-java - scm:git:git@github.com:Azure/azure-sdk-for-java.git - scm:git:git@github.com:Azure/azure-sdk-for-java.git - HEAD - - - - microsoft - Microsoft - - - - UTF-8 - - - - - com.azure - azure-core - 1.18.0 - - - com.azure - azure-core-management - 1.3.1 - - - - - - org.jacoco - jacoco-maven-plugin - 0.8.5 - - true - - - - + + https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-for-java.git + scm:git:git@github.com:Azure/azure-sdk-for-java.git + HEAD + + + + microsoft + Microsoft + + + + UTF-8 + + + + + com.azure + azure-core + 1.18.0 + + + com.azure + azure-core-management + 1.3.1 + + + + + + org.jacoco + jacoco-maven-plugin + 0.8.5 + + true + + + + org.revapi + revapi-maven-plugin + 0.11.2 + + + + + java.method.addedToInterface + + + true + .* + com\.azure\.resourcemanager(\.[^.]+)+\.fluent(\.[^.]+)* + + + + + + + diff --git a/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/StorageCacheManager.java b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/StorageCacheManager.java index 3699ee950a0c..7d4f936f4a71 100644 --- a/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/StorageCacheManager.java +++ b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/StorageCacheManager.java @@ -9,7 +9,6 @@ import com.azure.core.http.HttpPipeline; import com.azure.core.http.HttpPipelineBuilder; import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.BearerTokenAuthenticationPolicy; import com.azure.core.http.policy.HttpLogOptions; import com.azure.core.http.policy.HttpLoggingPolicy; import com.azure.core.http.policy.HttpPipelinePolicy; @@ -17,6 +16,7 @@ import com.azure.core.http.policy.RequestIdPolicy; import com.azure.core.http.policy.RetryPolicy; import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.http.policy.ArmChallengeAuthenticationPolicy; import com.azure.core.management.profile.AzureProfile; import com.azure.core.util.Configuration; import com.azure.core.util.logging.ClientLogger; @@ -26,12 +26,14 @@ import com.azure.resourcemanager.storagecache.implementation.OperationsImpl; import com.azure.resourcemanager.storagecache.implementation.SkusImpl; import com.azure.resourcemanager.storagecache.implementation.StorageCacheManagementClientBuilder; +import com.azure.resourcemanager.storagecache.implementation.StorageTargetOperationsImpl; import com.azure.resourcemanager.storagecache.implementation.StorageTargetsImpl; import com.azure.resourcemanager.storagecache.implementation.UsageModelsImpl; import com.azure.resourcemanager.storagecache.models.AscOperations; import com.azure.resourcemanager.storagecache.models.Caches; import com.azure.resourcemanager.storagecache.models.Operations; import com.azure.resourcemanager.storagecache.models.Skus; +import com.azure.resourcemanager.storagecache.models.StorageTargetOperations; import com.azure.resourcemanager.storagecache.models.StorageTargets; import com.azure.resourcemanager.storagecache.models.UsageModels; import java.time.Duration; @@ -58,6 +60,8 @@ public final class StorageCacheManager { private StorageTargets storageTargets; + private StorageTargetOperations storageTargetOperations; + private final StorageCacheManagementClient clientObject; private StorageCacheManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { @@ -101,6 +105,7 @@ public static final class Configurable { private HttpClient httpClient; private HttpLogOptions httpLogOptions; private final List policies = new ArrayList<>(); + private final List scopes = new ArrayList<>(); private RetryPolicy retryPolicy; private Duration defaultPollInterval; @@ -140,6 +145,17 @@ public Configurable withPolicy(HttpPipelinePolicy policy) { return this; } + /** + * Adds the scope to permission sets. + * + * @param scope the scope. + * @return the configurable object itself. + */ + public Configurable withScope(String scope) { + this.scopes.add(Objects.requireNonNull(scope, "'scope' cannot be null.")); + return this; + } + /** * Sets the retry policy to the HTTP pipeline. * @@ -182,7 +198,7 @@ public StorageCacheManager authenticate(TokenCredential credential, AzureProfile .append("-") .append("com.azure.resourcemanager.storagecache") .append("/") - .append("1.0.0-beta.2"); + .append("1.0.0-beta.1"); if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) { userAgentBuilder .append(" (") @@ -196,6 +212,9 @@ public StorageCacheManager authenticate(TokenCredential credential, AzureProfile userAgentBuilder.append(" (auto-generated)"); } + if (scopes.isEmpty()) { + scopes.add(profile.getEnvironment().getManagementEndpoint() + "/.default"); + } if (retryPolicy == null) { retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS); } @@ -205,10 +224,8 @@ public StorageCacheManager authenticate(TokenCredential credential, AzureProfile HttpPolicyProviders.addBeforeRetryPolicies(policies); policies.add(retryPolicy); policies.add(new AddDatePolicy()); - policies - .add( - new BearerTokenAuthenticationPolicy( - credential, profile.getEnvironment().getManagementEndpoint() + "/.default")); + policies.add(new ArmChallengeAuthenticationPolicy(credential, scopes.toArray(new String[0]))); + policies.addAll(this.policies); HttpPolicyProviders.addAfterRetryPolicies(policies); policies.add(new HttpLoggingPolicy(httpLogOptions)); HttpPipeline httpPipeline = @@ -268,6 +285,15 @@ public StorageTargets storageTargets() { return storageTargets; } + /** @return Resource collection API of StorageTargetOperations. */ + public StorageTargetOperations storageTargetOperations() { + if (this.storageTargetOperations == null) { + this.storageTargetOperations = + new StorageTargetOperationsImpl(clientObject.getStorageTargetOperations(), this); + } + return storageTargetOperations; + } + /** * @return Wrapped service client StorageCacheManagementClient providing direct access to the underlying * auto-generated API implementation, based on Azure REST API. diff --git a/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/fluent/StorageCacheManagementClient.java b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/fluent/StorageCacheManagementClient.java index b08a838a3cb9..78c40c690162 100644 --- a/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/fluent/StorageCacheManagementClient.java +++ b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/fluent/StorageCacheManagementClient.java @@ -86,4 +86,11 @@ public interface StorageCacheManagementClient { * @return the StorageTargetsClient object. */ StorageTargetsClient getStorageTargets(); + + /** + * Gets the StorageTargetOperationsClient object to access its operations. + * + * @return the StorageTargetOperationsClient object. + */ + StorageTargetOperationsClient getStorageTargetOperations(); } diff --git a/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/fluent/StorageTargetOperationsClient.java b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/fluent/StorageTargetOperationsClient.java new file mode 100644 index 000000000000..fad3bd286409 --- /dev/null +++ b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/fluent/StorageTargetOperationsClient.java @@ -0,0 +1,203 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagecache.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; + +/** An instance of this class provides access to all the operations defined in StorageTargetOperationsClient. */ +public interface StorageTargetOperationsClient { + /** + * Tells the cache to write all dirty data to the Storage Target's backend storage. Client requests to this storage + * target's namespace will return errors until the flush operation completes. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @param storageTargetName Name of Storage Target. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginFlush(String resourceGroupName, String cacheName, String storageTargetName); + + /** + * Tells the cache to write all dirty data to the Storage Target's backend storage. Client requests to this storage + * target's namespace will return errors until the flush operation completes. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @param storageTargetName Name of Storage Target. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginFlush( + String resourceGroupName, String cacheName, String storageTargetName, Context context); + + /** + * Tells the cache to write all dirty data to the Storage Target's backend storage. Client requests to this storage + * target's namespace will return errors until the flush operation completes. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @param storageTargetName Name of Storage Target. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void flush(String resourceGroupName, String cacheName, String storageTargetName); + + /** + * Tells the cache to write all dirty data to the Storage Target's backend storage. Client requests to this storage + * target's namespace will return errors until the flush operation completes. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @param storageTargetName Name of Storage Target. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void flush(String resourceGroupName, String cacheName, String storageTargetName, Context context); + + /** + * Suspends client access to a storage target. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @param storageTargetName Name of Storage Target. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginSuspend( + String resourceGroupName, String cacheName, String storageTargetName); + + /** + * Suspends client access to a storage target. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @param storageTargetName Name of Storage Target. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginSuspend( + String resourceGroupName, String cacheName, String storageTargetName, Context context); + + /** + * Suspends client access to a storage target. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @param storageTargetName Name of Storage Target. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void suspend(String resourceGroupName, String cacheName, String storageTargetName); + + /** + * Suspends client access to a storage target. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @param storageTargetName Name of Storage Target. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void suspend(String resourceGroupName, String cacheName, String storageTargetName, Context context); + + /** + * Resumes client access to a previously suspended storage target. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @param storageTargetName Name of Storage Target. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginResume( + String resourceGroupName, String cacheName, String storageTargetName); + + /** + * Resumes client access to a previously suspended storage target. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @param storageTargetName Name of Storage Target. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginResume( + String resourceGroupName, String cacheName, String storageTargetName, Context context); + + /** + * Resumes client access to a previously suspended storage target. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @param storageTargetName Name of Storage Target. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void resume(String resourceGroupName, String cacheName, String storageTargetName); + + /** + * Resumes client access to a previously suspended storage target. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @param storageTargetName Name of Storage Target. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void resume(String resourceGroupName, String cacheName, String storageTargetName, Context context); +} diff --git a/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/fluent/StorageTargetsClient.java b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/fluent/StorageTargetsClient.java index 83ca08705eb1..7c5354d6a1b6 100644 --- a/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/fluent/StorageTargetsClient.java +++ b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/fluent/StorageTargetsClient.java @@ -116,6 +116,8 @@ SyncPoller, Void> beginDnsRefresh( * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the * [-0-9a-zA-Z_] char class. * @param storageTargetName Name of Storage Target. + * @param force Boolean value requesting the force delete operation for a storage target. Force delete discards + * unwritten-data in the cache instead of flushing it to back-end storage. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -123,7 +125,7 @@ SyncPoller, Void> beginDnsRefresh( */ @ServiceMethod(returns = ReturnType.SINGLE) SyncPoller, Void> beginDelete( - String resourceGroupName, String cacheName, String storageTargetName); + String resourceGroupName, String cacheName, String storageTargetName, String force); /** * Removes a Storage Target from a Cache. This operation is allowed at any time, but if the Cache is down or @@ -135,6 +137,8 @@ SyncPoller, Void> beginDelete( * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the * [-0-9a-zA-Z_] char class. * @param storageTargetName Name of Storage Target. + * @param force Boolean value requesting the force delete operation for a storage target. Force delete discards + * unwritten-data in the cache instead of flushing it to back-end storage. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -143,7 +147,26 @@ SyncPoller, Void> beginDelete( */ @ServiceMethod(returns = ReturnType.SINGLE) SyncPoller, Void> beginDelete( - String resourceGroupName, String cacheName, String storageTargetName, Context context); + String resourceGroupName, String cacheName, String storageTargetName, String force, Context context); + + /** + * Removes a Storage Target from a Cache. This operation is allowed at any time, but if the Cache is down or + * unhealthy, the actual removal of the Storage Target may be delayed until the Cache is healthy again. Note that if + * the Cache has data to flush to the Storage Target, the data will be flushed before the Storage Target will be + * deleted. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @param storageTargetName Name of Storage Target. + * @param force Boolean value requesting the force delete operation for a storage target. Force delete discards + * unwritten-data in the cache instead of flushing it to back-end storage. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String cacheName, String storageTargetName, String force); /** * Removes a Storage Target from a Cache. This operation is allowed at any time, but if the Cache is down or @@ -172,13 +195,15 @@ SyncPoller, Void> beginDelete( * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the * [-0-9a-zA-Z_] char class. * @param storageTargetName Name of Storage Target. + * @param force Boolean value requesting the force delete operation for a storage target. Force delete discards + * unwritten-data in the cache instead of flushing it to back-end storage. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. */ @ServiceMethod(returns = ReturnType.SINGLE) - void delete(String resourceGroupName, String cacheName, String storageTargetName, Context context); + void delete(String resourceGroupName, String cacheName, String storageTargetName, String force, Context context); /** * Returns a Storage Target from a Cache. diff --git a/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/fluent/models/CacheInner.java b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/fluent/models/CacheInner.java index 18908024052e..c6c515e422c9 100644 --- a/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/fluent/models/CacheInner.java +++ b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/fluent/models/CacheInner.java @@ -7,6 +7,7 @@ import com.azure.core.annotation.Fluent; import com.azure.core.annotation.JsonFlatten; import com.azure.core.management.Resource; +import com.azure.core.management.SystemData; import com.azure.core.util.logging.ClientLogger; import com.azure.resourcemanager.storagecache.models.CacheDirectorySettings; import com.azure.resourcemanager.storagecache.models.CacheEncryptionSettings; @@ -17,7 +18,6 @@ import com.azure.resourcemanager.storagecache.models.CacheSku; import com.azure.resourcemanager.storagecache.models.CacheUpgradeStatus; import com.azure.resourcemanager.storagecache.models.ProvisioningStateType; -import com.azure.resourcemanager.storagecache.models.SystemData; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; import java.util.List; @@ -72,7 +72,7 @@ public class CacheInner extends Resource { * ARM provisioning state, see * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/Addendum.md#provisioningstate-property */ - @JsonProperty(value = "properties.provisioningState") + @JsonProperty(value = "properties.provisioningState", access = JsonProperty.Access.WRITE_ONLY) private ProvisioningStateType provisioningState; /* @@ -84,7 +84,7 @@ public class CacheInner extends Resource { /* * Upgrade status of the Cache. */ - @JsonProperty(value = "properties.upgradeStatus") + @JsonProperty(value = "properties.upgradeStatus", access = JsonProperty.Access.WRITE_ONLY) private CacheUpgradeStatus upgradeStatus; /* @@ -208,18 +208,6 @@ public ProvisioningStateType provisioningState() { return this.provisioningState; } - /** - * Set the provisioningState property: ARM provisioning state, see - * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/Addendum.md#provisioningstate-property. - * - * @param provisioningState the provisioningState value to set. - * @return the CacheInner object itself. - */ - public CacheInner withProvisioningState(ProvisioningStateType provisioningState) { - this.provisioningState = provisioningState; - return this; - } - /** * Get the subnet property: Subnet used for the Cache. * @@ -249,17 +237,6 @@ public CacheUpgradeStatus upgradeStatus() { return this.upgradeStatus; } - /** - * Set the upgradeStatus property: Upgrade status of the Cache. - * - * @param upgradeStatus the upgradeStatus value to set. - * @return the CacheInner object itself. - */ - public CacheInner withUpgradeStatus(CacheUpgradeStatus upgradeStatus) { - this.upgradeStatus = upgradeStatus; - return this; - } - /** * Get the networkSettings property: Specifies network settings of the cache. * @@ -363,9 +340,6 @@ public void validate() { if (identity() != null) { identity().validate(); } - if (systemData() != null) { - systemData().validate(); - } if (sku() != null) { sku().validate(); } diff --git a/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/fluent/models/StorageTargetInner.java b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/fluent/models/StorageTargetInner.java index 94e231163159..a9a2595bac5e 100644 --- a/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/fluent/models/StorageTargetInner.java +++ b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/fluent/models/StorageTargetInner.java @@ -41,7 +41,7 @@ public class StorageTargetInner extends StorageTargetResource { * ARM provisioning state, see * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/Addendum.md#provisioningstate-property */ - @JsonProperty(value = "properties.provisioningState") + @JsonProperty(value = "properties.provisioningState", access = JsonProperty.Access.WRITE_ONLY) private ProvisioningStateType provisioningState; /* @@ -118,18 +118,6 @@ public ProvisioningStateType provisioningState() { return this.provisioningState; } - /** - * Set the provisioningState property: ARM provisioning state, see - * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/Addendum.md#provisioningstate-property. - * - * @param provisioningState the provisioningState value to set. - * @return the StorageTargetInner object itself. - */ - public StorageTargetInner withProvisioningState(ProvisioningStateType provisioningState) { - this.provisioningState = provisioningState; - return this; - } - /** * Get the nfs3 property: Properties when targetType is nfs3. * diff --git a/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/implementation/AscOperationsClientImpl.java b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/implementation/AscOperationsClientImpl.java index 4dae83dbd7ec..74a8743e24a0 100644 --- a/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/implementation/AscOperationsClientImpl.java +++ b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/implementation/AscOperationsClientImpl.java @@ -113,7 +113,7 @@ private Mono> getWithResponseAsync(String location, operationId, 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/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/implementation/CacheImpl.java b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/implementation/CacheImpl.java index 8ceedae9d6cc..df562965ec5b 100644 --- a/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/implementation/CacheImpl.java +++ b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/implementation/CacheImpl.java @@ -5,6 +5,7 @@ package com.azure.resourcemanager.storagecache.implementation; import com.azure.core.management.Region; +import com.azure.core.management.SystemData; import com.azure.core.util.Context; import com.azure.resourcemanager.storagecache.fluent.models.CacheInner; import com.azure.resourcemanager.storagecache.models.Cache; @@ -17,7 +18,6 @@ import com.azure.resourcemanager.storagecache.models.CacheSku; import com.azure.resourcemanager.storagecache.models.CacheUpgradeStatus; import com.azure.resourcemanager.storagecache.models.ProvisioningStateType; -import com.azure.resourcemanager.storagecache.models.SystemData; import java.util.Collections; import java.util.List; import java.util.Map; @@ -279,21 +279,11 @@ public CacheImpl withCacheSizeGB(Integer cacheSizeGB) { return this; } - public CacheImpl withProvisioningState(ProvisioningStateType provisioningState) { - this.innerModel().withProvisioningState(provisioningState); - return this; - } - public CacheImpl withSubnet(String subnet) { this.innerModel().withSubnet(subnet); return this; } - public CacheImpl withUpgradeStatus(CacheUpgradeStatus upgradeStatus) { - this.innerModel().withUpgradeStatus(upgradeStatus); - return this; - } - public CacheImpl withNetworkSettings(CacheNetworkSettings networkSettings) { this.innerModel().withNetworkSettings(networkSettings); return this; diff --git a/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/implementation/CachesClientImpl.java b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/implementation/CachesClientImpl.java index 8aa67a53e5e8..c2196266594a 100644 --- a/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/implementation/CachesClientImpl.java +++ b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/implementation/CachesClientImpl.java @@ -292,7 +292,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())); } /** @@ -439,7 +439,7 @@ private Mono> listByResourceGroupSinglePageAsync(Strin 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())); } /** @@ -599,7 +599,7 @@ private Mono>> deleteWithResponseAsync(String resource this.client.getSubscriptionId(), accept, context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -834,7 +834,7 @@ private Mono> getByResourceGroupWithResponseAsync(String re this.client.getSubscriptionId(), accept, context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -994,7 +994,7 @@ private Mono>> createOrUpdateWithResponseAsync( cache, accept, context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -1305,7 +1305,7 @@ private Mono> updateWithResponseAsync( cache, accept, context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -1494,7 +1494,7 @@ private Mono>> debugInfoWithResponseAsync(String resou cacheName, accept, context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -1731,7 +1731,7 @@ private Mono>> flushWithResponseAsync(String resourceG cacheName, accept, context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -1975,7 +1975,7 @@ private Mono>> startWithResponseAsync(String resourceG cacheName, accept, context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -2210,7 +2210,7 @@ private Mono>> stopWithResponseAsync(String resourceGr cacheName, accept, context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -2446,7 +2446,7 @@ private Mono>> upgradeFirmwareWithResponseAsync( cacheName, accept, context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -2671,7 +2671,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())); } /** @@ -2743,7 +2743,7 @@ private Mono> listByResourceGroupNextSinglePageAsync(S 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/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/implementation/OperationsClientImpl.java b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/implementation/OperationsClientImpl.java index 48448fcb3797..dbba355188d6 100644 --- a/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/implementation/OperationsClientImpl.java +++ b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/implementation/OperationsClientImpl.java @@ -108,7 +108,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())); } /** @@ -228,7 +228,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/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/implementation/SkusClientImpl.java b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/implementation/SkusClientImpl.java index b9d4275a6a95..0d2646ae7a89 100644 --- a/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/implementation/SkusClientImpl.java +++ b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/implementation/SkusClientImpl.java @@ -121,7 +121,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())); } /** @@ -252,7 +252,7 @@ private Mono> listNextSinglePageAsync(String nex 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/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/implementation/StorageCacheManagementClientImpl.java b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/implementation/StorageCacheManagementClientImpl.java index 58959ac4e2ad..030fc6aaef55 100644 --- a/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/implementation/StorageCacheManagementClientImpl.java +++ b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/implementation/StorageCacheManagementClientImpl.java @@ -26,6 +26,7 @@ import com.azure.resourcemanager.storagecache.fluent.OperationsClient; import com.azure.resourcemanager.storagecache.fluent.SkusClient; import com.azure.resourcemanager.storagecache.fluent.StorageCacheManagementClient; +import com.azure.resourcemanager.storagecache.fluent.StorageTargetOperationsClient; import com.azure.resourcemanager.storagecache.fluent.StorageTargetsClient; import com.azure.resourcemanager.storagecache.fluent.UsageModelsClient; import java.io.IOException; @@ -191,6 +192,18 @@ public StorageTargetsClient getStorageTargets() { return this.storageTargets; } + /** The StorageTargetOperationsClient object to access its operations. */ + private final StorageTargetOperationsClient storageTargetOperations; + + /** + * Gets the StorageTargetOperationsClient object to access its operations. + * + * @return the StorageTargetOperationsClient object. + */ + public StorageTargetOperationsClient getStorageTargetOperations() { + return this.storageTargetOperations; + } + /** * Initializes an instance of StorageCacheManagementClient client. * @@ -214,13 +227,14 @@ public StorageTargetsClient getStorageTargets() { this.defaultPollInterval = defaultPollInterval; this.subscriptionId = subscriptionId; this.endpoint = endpoint; - this.apiVersion = "2021-03-01"; + this.apiVersion = "2021-05-01"; this.operations = new OperationsClientImpl(this); this.skus = new SkusClientImpl(this); this.usageModels = new UsageModelsClientImpl(this); this.ascOperations = new AscOperationsClientImpl(this); this.caches = new CachesClientImpl(this); this.storageTargets = new StorageTargetsClientImpl(this); + this.storageTargetOperations = new StorageTargetOperationsClientImpl(this); } /** diff --git a/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/implementation/StorageTargetImpl.java b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/implementation/StorageTargetImpl.java index 01512755b117..0474f4a67e00 100644 --- a/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/implementation/StorageTargetImpl.java +++ b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/implementation/StorageTargetImpl.java @@ -5,6 +5,7 @@ package com.azure.resourcemanager.storagecache.implementation; import com.azure.core.management.Region; +import com.azure.core.management.SystemData; import com.azure.core.util.Context; import com.azure.resourcemanager.storagecache.fluent.models.StorageTargetInner; import com.azure.resourcemanager.storagecache.models.BlobNfsTarget; @@ -14,7 +15,6 @@ import com.azure.resourcemanager.storagecache.models.ProvisioningStateType; import com.azure.resourcemanager.storagecache.models.StorageTarget; import com.azure.resourcemanager.storagecache.models.StorageTargetType; -import com.azure.resourcemanager.storagecache.models.SystemData; import com.azure.resourcemanager.storagecache.models.UnknownTarget; import java.util.Collections; import java.util.List; @@ -198,11 +198,6 @@ public StorageTargetImpl withTargetType(StorageTargetType targetType) { return this; } - public StorageTargetImpl withProvisioningState(ProvisioningStateType provisioningState) { - this.innerModel().withProvisioningState(provisioningState); - return this; - } - public StorageTargetImpl withNfs3(Nfs3Target nfs3) { this.innerModel().withNfs3(nfs3); return this; diff --git a/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/implementation/StorageTargetOperationsClientImpl.java b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/implementation/StorageTargetOperationsClientImpl.java new file mode 100644 index 000000000000..150c973c1772 --- /dev/null +++ b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/implementation/StorageTargetOperationsClientImpl.java @@ -0,0 +1,911 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagecache.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.storagecache.fluent.StorageTargetOperationsClient; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in StorageTargetOperationsClient. */ +public final class StorageTargetOperationsClientImpl implements StorageTargetOperationsClient { + private final ClientLogger logger = new ClientLogger(StorageTargetOperationsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final StorageTargetOperationsService service; + + /** The service client containing this operation class. */ + private final StorageCacheManagementClientImpl client; + + /** + * Initializes an instance of StorageTargetOperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + StorageTargetOperationsClientImpl(StorageCacheManagementClientImpl client) { + this.service = + RestProxy + .create(StorageTargetOperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for StorageCacheManagementClientStorageTargetOperations to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "StorageCacheManageme") + private interface StorageTargetOperationsService { + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches" + + "/{cacheName}/storageTargets/{storageTargetName}/flush") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> flush( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("cacheName") String cacheName, + @PathParam("storageTargetName") String storageTargetName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches" + + "/{cacheName}/storageTargets/{storageTargetName}/suspend") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> suspend( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("cacheName") String cacheName, + @PathParam("storageTargetName") String storageTargetName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches" + + "/{cacheName}/storageTargets/{storageTargetName}/resume") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> resume( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("cacheName") String cacheName, + @PathParam("storageTargetName") String storageTargetName, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Tells the cache to write all dirty data to the Storage Target's backend storage. Client requests to this storage + * target's namespace will return errors until the flush operation completes. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @param storageTargetName Name of Storage Target. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> flushWithResponseAsync( + String resourceGroupName, String cacheName, String storageTargetName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (cacheName == null) { + return Mono.error(new IllegalArgumentException("Parameter cacheName is required and cannot be null.")); + } + if (storageTargetName == null) { + return Mono + .error(new IllegalArgumentException("Parameter storageTargetName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .flush( + this.client.getEndpoint(), + resourceGroupName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + cacheName, + storageTargetName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Tells the cache to write all dirty data to the Storage Target's backend storage. Client requests to this storage + * target's namespace will return errors until the flush operation completes. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @param storageTargetName Name of Storage Target. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> flushWithResponseAsync( + String resourceGroupName, String cacheName, String storageTargetName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (cacheName == null) { + return Mono.error(new IllegalArgumentException("Parameter cacheName is required and cannot be null.")); + } + if (storageTargetName == null) { + return Mono + .error(new IllegalArgumentException("Parameter storageTargetName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .flush( + this.client.getEndpoint(), + resourceGroupName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + cacheName, + storageTargetName, + accept, + context); + } + + /** + * Tells the cache to write all dirty data to the Storage Target's backend storage. Client requests to this storage + * target's namespace will return errors until the flush operation completes. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @param storageTargetName Name of Storage Target. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginFlushAsync( + String resourceGroupName, String cacheName, String storageTargetName) { + Mono>> mono = flushWithResponseAsync(resourceGroupName, cacheName, storageTargetName); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Tells the cache to write all dirty data to the Storage Target's backend storage. Client requests to this storage + * target's namespace will return errors until the flush operation completes. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @param storageTargetName Name of Storage Target. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginFlushAsync( + String resourceGroupName, String cacheName, String storageTargetName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + flushWithResponseAsync(resourceGroupName, cacheName, storageTargetName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Tells the cache to write all dirty data to the Storage Target's backend storage. Client requests to this storage + * target's namespace will return errors until the flush operation completes. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @param storageTargetName Name of Storage Target. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginFlush( + String resourceGroupName, String cacheName, String storageTargetName) { + return beginFlushAsync(resourceGroupName, cacheName, storageTargetName).getSyncPoller(); + } + + /** + * Tells the cache to write all dirty data to the Storage Target's backend storage. Client requests to this storage + * target's namespace will return errors until the flush operation completes. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @param storageTargetName Name of Storage Target. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginFlush( + String resourceGroupName, String cacheName, String storageTargetName, Context context) { + return beginFlushAsync(resourceGroupName, cacheName, storageTargetName, context).getSyncPoller(); + } + + /** + * Tells the cache to write all dirty data to the Storage Target's backend storage. Client requests to this storage + * target's namespace will return errors until the flush operation completes. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @param storageTargetName Name of Storage Target. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono flushAsync(String resourceGroupName, String cacheName, String storageTargetName) { + return beginFlushAsync(resourceGroupName, cacheName, storageTargetName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Tells the cache to write all dirty data to the Storage Target's backend storage. Client requests to this storage + * target's namespace will return errors until the flush operation completes. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @param storageTargetName Name of Storage Target. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono flushAsync( + String resourceGroupName, String cacheName, String storageTargetName, Context context) { + return beginFlushAsync(resourceGroupName, cacheName, storageTargetName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Tells the cache to write all dirty data to the Storage Target's backend storage. Client requests to this storage + * target's namespace will return errors until the flush operation completes. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @param storageTargetName Name of Storage Target. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void flush(String resourceGroupName, String cacheName, String storageTargetName) { + flushAsync(resourceGroupName, cacheName, storageTargetName).block(); + } + + /** + * Tells the cache to write all dirty data to the Storage Target's backend storage. Client requests to this storage + * target's namespace will return errors until the flush operation completes. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @param storageTargetName Name of Storage Target. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void flush(String resourceGroupName, String cacheName, String storageTargetName, Context context) { + flushAsync(resourceGroupName, cacheName, storageTargetName, context).block(); + } + + /** + * Suspends client access to a storage target. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @param storageTargetName Name of Storage Target. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> suspendWithResponseAsync( + String resourceGroupName, String cacheName, String storageTargetName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (cacheName == null) { + return Mono.error(new IllegalArgumentException("Parameter cacheName is required and cannot be null.")); + } + if (storageTargetName == null) { + return Mono + .error(new IllegalArgumentException("Parameter storageTargetName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .suspend( + this.client.getEndpoint(), + resourceGroupName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + cacheName, + storageTargetName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Suspends client access to a storage target. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @param storageTargetName Name of Storage Target. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> suspendWithResponseAsync( + String resourceGroupName, String cacheName, String storageTargetName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (cacheName == null) { + return Mono.error(new IllegalArgumentException("Parameter cacheName is required and cannot be null.")); + } + if (storageTargetName == null) { + return Mono + .error(new IllegalArgumentException("Parameter storageTargetName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .suspend( + this.client.getEndpoint(), + resourceGroupName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + cacheName, + storageTargetName, + accept, + context); + } + + /** + * Suspends client access to a storage target. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @param storageTargetName Name of Storage Target. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginSuspendAsync( + String resourceGroupName, String cacheName, String storageTargetName) { + Mono>> mono = + suspendWithResponseAsync(resourceGroupName, cacheName, storageTargetName); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Suspends client access to a storage target. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @param storageTargetName Name of Storage Target. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginSuspendAsync( + String resourceGroupName, String cacheName, String storageTargetName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + suspendWithResponseAsync(resourceGroupName, cacheName, storageTargetName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Suspends client access to a storage target. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @param storageTargetName Name of Storage Target. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginSuspend( + String resourceGroupName, String cacheName, String storageTargetName) { + return beginSuspendAsync(resourceGroupName, cacheName, storageTargetName).getSyncPoller(); + } + + /** + * Suspends client access to a storage target. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @param storageTargetName Name of Storage Target. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginSuspend( + String resourceGroupName, String cacheName, String storageTargetName, Context context) { + return beginSuspendAsync(resourceGroupName, cacheName, storageTargetName, context).getSyncPoller(); + } + + /** + * Suspends client access to a storage target. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @param storageTargetName Name of Storage Target. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono suspendAsync(String resourceGroupName, String cacheName, String storageTargetName) { + return beginSuspendAsync(resourceGroupName, cacheName, storageTargetName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Suspends client access to a storage target. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @param storageTargetName Name of Storage Target. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono suspendAsync( + String resourceGroupName, String cacheName, String storageTargetName, Context context) { + return beginSuspendAsync(resourceGroupName, cacheName, storageTargetName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Suspends client access to a storage target. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @param storageTargetName Name of Storage Target. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void suspend(String resourceGroupName, String cacheName, String storageTargetName) { + suspendAsync(resourceGroupName, cacheName, storageTargetName).block(); + } + + /** + * Suspends client access to a storage target. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @param storageTargetName Name of Storage Target. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void suspend(String resourceGroupName, String cacheName, String storageTargetName, Context context) { + suspendAsync(resourceGroupName, cacheName, storageTargetName, context).block(); + } + + /** + * Resumes client access to a previously suspended storage target. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @param storageTargetName Name of Storage Target. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> resumeWithResponseAsync( + String resourceGroupName, String cacheName, String storageTargetName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (cacheName == null) { + return Mono.error(new IllegalArgumentException("Parameter cacheName is required and cannot be null.")); + } + if (storageTargetName == null) { + return Mono + .error(new IllegalArgumentException("Parameter storageTargetName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .resume( + this.client.getEndpoint(), + resourceGroupName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + cacheName, + storageTargetName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Resumes client access to a previously suspended storage target. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @param storageTargetName Name of Storage Target. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> resumeWithResponseAsync( + String resourceGroupName, String cacheName, String storageTargetName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (cacheName == null) { + return Mono.error(new IllegalArgumentException("Parameter cacheName is required and cannot be null.")); + } + if (storageTargetName == null) { + return Mono + .error(new IllegalArgumentException("Parameter storageTargetName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .resume( + this.client.getEndpoint(), + resourceGroupName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + cacheName, + storageTargetName, + accept, + context); + } + + /** + * Resumes client access to a previously suspended storage target. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @param storageTargetName Name of Storage Target. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginResumeAsync( + String resourceGroupName, String cacheName, String storageTargetName) { + Mono>> mono = + resumeWithResponseAsync(resourceGroupName, cacheName, storageTargetName); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Resumes client access to a previously suspended storage target. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @param storageTargetName Name of Storage Target. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginResumeAsync( + String resourceGroupName, String cacheName, String storageTargetName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + resumeWithResponseAsync(resourceGroupName, cacheName, storageTargetName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Resumes client access to a previously suspended storage target. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @param storageTargetName Name of Storage Target. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginResume( + String resourceGroupName, String cacheName, String storageTargetName) { + return beginResumeAsync(resourceGroupName, cacheName, storageTargetName).getSyncPoller(); + } + + /** + * Resumes client access to a previously suspended storage target. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @param storageTargetName Name of Storage Target. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginResume( + String resourceGroupName, String cacheName, String storageTargetName, Context context) { + return beginResumeAsync(resourceGroupName, cacheName, storageTargetName, context).getSyncPoller(); + } + + /** + * Resumes client access to a previously suspended storage target. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @param storageTargetName Name of Storage Target. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono resumeAsync(String resourceGroupName, String cacheName, String storageTargetName) { + return beginResumeAsync(resourceGroupName, cacheName, storageTargetName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Resumes client access to a previously suspended storage target. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @param storageTargetName Name of Storage Target. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono resumeAsync( + String resourceGroupName, String cacheName, String storageTargetName, Context context) { + return beginResumeAsync(resourceGroupName, cacheName, storageTargetName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Resumes client access to a previously suspended storage target. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @param storageTargetName Name of Storage Target. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void resume(String resourceGroupName, String cacheName, String storageTargetName) { + resumeAsync(resourceGroupName, cacheName, storageTargetName).block(); + } + + /** + * Resumes client access to a previously suspended storage target. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @param storageTargetName Name of Storage Target. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void resume(String resourceGroupName, String cacheName, String storageTargetName, Context context) { + resumeAsync(resourceGroupName, cacheName, storageTargetName, context).block(); + } +} diff --git a/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/implementation/StorageTargetOperationsImpl.java b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/implementation/StorageTargetOperationsImpl.java new file mode 100644 index 000000000000..a716e8259a4f --- /dev/null +++ b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/implementation/StorageTargetOperationsImpl.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagecache.implementation; + +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.storagecache.fluent.StorageTargetOperationsClient; +import com.azure.resourcemanager.storagecache.models.StorageTargetOperations; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class StorageTargetOperationsImpl implements StorageTargetOperations { + @JsonIgnore private final ClientLogger logger = new ClientLogger(StorageTargetOperationsImpl.class); + + private final StorageTargetOperationsClient innerClient; + + private final com.azure.resourcemanager.storagecache.StorageCacheManager serviceManager; + + public StorageTargetOperationsImpl( + StorageTargetOperationsClient innerClient, + com.azure.resourcemanager.storagecache.StorageCacheManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public void flush(String resourceGroupName, String cacheName, String storageTargetName) { + this.serviceClient().flush(resourceGroupName, cacheName, storageTargetName); + } + + public void flush(String resourceGroupName, String cacheName, String storageTargetName, Context context) { + this.serviceClient().flush(resourceGroupName, cacheName, storageTargetName, context); + } + + public void suspend(String resourceGroupName, String cacheName, String storageTargetName) { + this.serviceClient().suspend(resourceGroupName, cacheName, storageTargetName); + } + + public void suspend(String resourceGroupName, String cacheName, String storageTargetName, Context context) { + this.serviceClient().suspend(resourceGroupName, cacheName, storageTargetName, context); + } + + public void resume(String resourceGroupName, String cacheName, String storageTargetName) { + this.serviceClient().resume(resourceGroupName, cacheName, storageTargetName); + } + + public void resume(String resourceGroupName, String cacheName, String storageTargetName, Context context) { + this.serviceClient().resume(resourceGroupName, cacheName, storageTargetName, context); + } + + private StorageTargetOperationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.storagecache.StorageCacheManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/implementation/StorageTargetsClientImpl.java b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/implementation/StorageTargetsClientImpl.java index c9bafee10fa8..82907f44ca05 100644 --- a/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/implementation/StorageTargetsClientImpl.java +++ b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/implementation/StorageTargetsClientImpl.java @@ -112,6 +112,7 @@ Mono>> delete( @PathParam("subscriptionId") String subscriptionId, @PathParam("cacheName") String cacheName, @PathParam("storageTargetName") String storageTargetName, + @QueryParam("force") String force, @HeaderParam("Accept") String accept, Context context); @@ -211,7 +212,7 @@ private Mono>> dnsRefreshWithResponseAsync( storageTargetName, accept, context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -478,7 +479,7 @@ private Mono> listByCacheSinglePageAsync( 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())); } /** @@ -618,6 +619,8 @@ public PagedIterable listByCache(String resourceGroupName, S * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the * [-0-9a-zA-Z_] char class. * @param storageTargetName Name of Storage Target. + * @param force Boolean value requesting the force delete operation for a storage target. Force delete discards + * unwritten-data in the cache instead of flushing it to back-end storage. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -625,7 +628,7 @@ public PagedIterable listByCache(String resourceGroupName, S */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono>> deleteWithResponseAsync( - String resourceGroupName, String cacheName, String storageTargetName) { + String resourceGroupName, String cacheName, String storageTargetName, String force) { if (this.client.getEndpoint() == null) { return Mono .error( @@ -661,9 +664,10 @@ private Mono>> deleteWithResponseAsync( this.client.getSubscriptionId(), cacheName, storageTargetName, + force, accept, context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -676,6 +680,8 @@ private Mono>> deleteWithResponseAsync( * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the * [-0-9a-zA-Z_] char class. * @param storageTargetName Name of Storage Target. + * @param force Boolean value requesting the force delete operation for a storage target. Force delete discards + * unwritten-data in the cache instead of flushing it to back-end storage. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -684,7 +690,7 @@ private Mono>> deleteWithResponseAsync( */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono>> deleteWithResponseAsync( - String resourceGroupName, String cacheName, String storageTargetName, Context context) { + String resourceGroupName, String cacheName, String storageTargetName, String force, Context context) { if (this.client.getEndpoint() == null) { return Mono .error( @@ -718,6 +724,7 @@ private Mono>> deleteWithResponseAsync( this.client.getSubscriptionId(), cacheName, storageTargetName, + force, accept, context); } @@ -732,6 +739,8 @@ private Mono>> deleteWithResponseAsync( * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the * [-0-9a-zA-Z_] char class. * @param storageTargetName Name of Storage Target. + * @param force Boolean value requesting the force delete operation for a storage target. Force delete discards + * unwritten-data in the cache instead of flushing it to back-end storage. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -739,9 +748,9 @@ private Mono>> deleteWithResponseAsync( */ @ServiceMethod(returns = ReturnType.SINGLE) private PollerFlux, Void> beginDeleteAsync( - String resourceGroupName, String cacheName, String storageTargetName) { + String resourceGroupName, String cacheName, String storageTargetName, String force) { Mono>> mono = - deleteWithResponseAsync(resourceGroupName, cacheName, storageTargetName); + deleteWithResponseAsync(resourceGroupName, cacheName, storageTargetName, force); return this .client .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); @@ -757,6 +766,8 @@ private PollerFlux, Void> beginDeleteAsync( * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the * [-0-9a-zA-Z_] char class. * @param storageTargetName Name of Storage Target. + * @param force Boolean value requesting the force delete operation for a storage target. Force delete discards + * unwritten-data in the cache instead of flushing it to back-end storage. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -765,10 +776,10 @@ private PollerFlux, Void> beginDeleteAsync( */ @ServiceMethod(returns = ReturnType.SINGLE) private PollerFlux, Void> beginDeleteAsync( - String resourceGroupName, String cacheName, String storageTargetName, Context context) { + String resourceGroupName, String cacheName, String storageTargetName, String force, Context context) { context = this.client.mergeContext(context); Mono>> mono = - deleteWithResponseAsync(resourceGroupName, cacheName, storageTargetName, context); + deleteWithResponseAsync(resourceGroupName, cacheName, storageTargetName, force, context); return this .client .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); @@ -784,6 +795,8 @@ private PollerFlux, Void> beginDeleteAsync( * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the * [-0-9a-zA-Z_] char class. * @param storageTargetName Name of Storage Target. + * @param force Boolean value requesting the force delete operation for a storage target. Force delete discards + * unwritten-data in the cache instead of flushing it to back-end storage. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -791,8 +804,8 @@ private PollerFlux, Void> beginDeleteAsync( */ @ServiceMethod(returns = ReturnType.SINGLE) public SyncPoller, Void> beginDelete( - String resourceGroupName, String cacheName, String storageTargetName) { - return beginDeleteAsync(resourceGroupName, cacheName, storageTargetName).getSyncPoller(); + String resourceGroupName, String cacheName, String storageTargetName, String force) { + return beginDeleteAsync(resourceGroupName, cacheName, storageTargetName, force).getSyncPoller(); } /** @@ -805,6 +818,8 @@ public SyncPoller, Void> beginDelete( * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the * [-0-9a-zA-Z_] char class. * @param storageTargetName Name of Storage Target. + * @param force Boolean value requesting the force delete operation for a storage target. Force delete discards + * unwritten-data in the cache instead of flushing it to back-end storage. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -813,8 +828,32 @@ public SyncPoller, Void> beginDelete( */ @ServiceMethod(returns = ReturnType.SINGLE) public SyncPoller, Void> beginDelete( - String resourceGroupName, String cacheName, String storageTargetName, Context context) { - return beginDeleteAsync(resourceGroupName, cacheName, storageTargetName, context).getSyncPoller(); + String resourceGroupName, String cacheName, String storageTargetName, String force, Context context) { + return beginDeleteAsync(resourceGroupName, cacheName, storageTargetName, force, context).getSyncPoller(); + } + + /** + * Removes a Storage Target from a Cache. This operation is allowed at any time, but if the Cache is down or + * unhealthy, the actual removal of the Storage Target may be delayed until the Cache is healthy again. Note that if + * the Cache has data to flush to the Storage Target, the data will be flushed before the Storage Target will be + * deleted. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @param storageTargetName Name of Storage Target. + * @param force Boolean value requesting the force delete operation for a storage target. Force delete discards + * unwritten-data in the cache instead of flushing it to back-end storage. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String cacheName, String storageTargetName, String force) { + return beginDeleteAsync(resourceGroupName, cacheName, storageTargetName, force) + .last() + .flatMap(this.client::getLroFinalResultOrError); } /** @@ -834,7 +873,8 @@ public SyncPoller, Void> beginDelete( */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono deleteAsync(String resourceGroupName, String cacheName, String storageTargetName) { - return beginDeleteAsync(resourceGroupName, cacheName, storageTargetName) + final String force = null; + return beginDeleteAsync(resourceGroupName, cacheName, storageTargetName, force) .last() .flatMap(this.client::getLroFinalResultOrError); } @@ -849,6 +889,8 @@ private Mono deleteAsync(String resourceGroupName, String cacheName, Strin * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the * [-0-9a-zA-Z_] char class. * @param storageTargetName Name of Storage Target. + * @param force Boolean value requesting the force delete operation for a storage target. Force delete discards + * unwritten-data in the cache instead of flushing it to back-end storage. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -857,12 +899,33 @@ private Mono deleteAsync(String resourceGroupName, String cacheName, Strin */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono deleteAsync( - String resourceGroupName, String cacheName, String storageTargetName, Context context) { - return beginDeleteAsync(resourceGroupName, cacheName, storageTargetName, context) + String resourceGroupName, String cacheName, String storageTargetName, String force, Context context) { + return beginDeleteAsync(resourceGroupName, cacheName, storageTargetName, force, context) .last() .flatMap(this.client::getLroFinalResultOrError); } + /** + * Removes a Storage Target from a Cache. This operation is allowed at any time, but if the Cache is down or + * unhealthy, the actual removal of the Storage Target may be delayed until the Cache is healthy again. Note that if + * the Cache has data to flush to the Storage Target, the data will be flushed before the Storage Target will be + * deleted. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @param storageTargetName Name of Storage Target. + * @param force Boolean value requesting the force delete operation for a storage target. Force delete discards + * unwritten-data in the cache instead of flushing it to back-end storage. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String cacheName, String storageTargetName, String force) { + deleteAsync(resourceGroupName, cacheName, storageTargetName, force).block(); + } + /** * Removes a Storage Target from a Cache. This operation is allowed at any time, but if the Cache is down or * unhealthy, the actual removal of the Storage Target may be delayed until the Cache is healthy again. Note that if @@ -879,7 +942,8 @@ private Mono deleteAsync( */ @ServiceMethod(returns = ReturnType.SINGLE) public void delete(String resourceGroupName, String cacheName, String storageTargetName) { - deleteAsync(resourceGroupName, cacheName, storageTargetName).block(); + final String force = null; + deleteAsync(resourceGroupName, cacheName, storageTargetName, force).block(); } /** @@ -892,14 +956,17 @@ public void delete(String resourceGroupName, String cacheName, String storageTar * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the * [-0-9a-zA-Z_] char class. * @param storageTargetName Name of Storage Target. + * @param force Boolean value requesting the force delete operation for a storage target. Force delete discards + * unwritten-data in the cache instead of flushing it to back-end storage. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. */ @ServiceMethod(returns = ReturnType.SINGLE) - public void delete(String resourceGroupName, String cacheName, String storageTargetName, Context context) { - deleteAsync(resourceGroupName, cacheName, storageTargetName, context).block(); + public void delete( + String resourceGroupName, String cacheName, String storageTargetName, String force, Context context) { + deleteAsync(resourceGroupName, cacheName, storageTargetName, force, context).block(); } /** @@ -954,7 +1021,7 @@ private Mono> getWithResponseAsync( storageTargetName, accept, context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -1129,7 +1196,7 @@ private Mono>> createOrUpdateWithResponseAsync( storagetarget, accept, context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -1464,7 +1531,7 @@ private Mono> listByCacheNextSinglePageAsync(S 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/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/implementation/StorageTargetsImpl.java b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/implementation/StorageTargetsImpl.java index 0dec66a7b103..8bdbb6423517 100644 --- a/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/implementation/StorageTargetsImpl.java +++ b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/implementation/StorageTargetsImpl.java @@ -47,12 +47,17 @@ public PagedIterable listByCache(String resourceGroupName, String return Utils.mapPage(inner, inner1 -> new StorageTargetImpl(inner1, this.manager())); } + public void delete(String resourceGroupName, String cacheName, String storageTargetName, String force) { + this.serviceClient().delete(resourceGroupName, cacheName, storageTargetName, force); + } + public void delete(String resourceGroupName, String cacheName, String storageTargetName) { this.serviceClient().delete(resourceGroupName, cacheName, storageTargetName); } - public void delete(String resourceGroupName, String cacheName, String storageTargetName, Context context) { - this.serviceClient().delete(resourceGroupName, cacheName, storageTargetName, context); + public void delete( + String resourceGroupName, String cacheName, String storageTargetName, String force, Context context) { + this.serviceClient().delete(resourceGroupName, cacheName, storageTargetName, force, context); } public StorageTarget get(String resourceGroupName, String cacheName, String storageTargetName) { @@ -157,10 +162,11 @@ public void deleteById(String id) { String .format("The resource ID '%s' is not valid. Missing path segment 'storageTargets'.", id))); } - this.delete(resourceGroupName, cacheName, storageTargetName, Context.NONE); + String localForce = null; + this.delete(resourceGroupName, cacheName, storageTargetName, localForce, Context.NONE); } - public void deleteByIdWithResponse(String id, Context context) { + public void deleteByIdWithResponse(String id, String force, Context context) { String resourceGroupName = Utils.getValueFromIdByName(id, "resourcegroups"); if (resourceGroupName == null) { throw logger @@ -184,7 +190,7 @@ public void deleteByIdWithResponse(String id, Context context) { String .format("The resource ID '%s' is not valid. Missing path segment 'storageTargets'.", id))); } - this.delete(resourceGroupName, cacheName, storageTargetName, context); + this.delete(resourceGroupName, cacheName, storageTargetName, force, context); } private StorageTargetsClient serviceClient() { diff --git a/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/implementation/UsageModelsClientImpl.java b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/implementation/UsageModelsClientImpl.java index 9b6b216541fb..1d85e1a0a4ba 100644 --- a/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/implementation/UsageModelsClientImpl.java +++ b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/implementation/UsageModelsClientImpl.java @@ -122,7 +122,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())); } /** @@ -253,7 +253,7 @@ private Mono> listNextSinglePageAsync(String next 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/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/Cache.java b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/Cache.java index 3236e4d362da..96b96df25316 100644 --- a/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/Cache.java +++ b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/Cache.java @@ -5,6 +5,7 @@ package com.azure.resourcemanager.storagecache.models; import com.azure.core.management.Region; +import com.azure.core.management.SystemData; import com.azure.core.util.Context; import com.azure.resourcemanager.storagecache.fluent.models.CacheInner; import java.util.List; @@ -209,9 +210,7 @@ interface WithCreate DefinitionStages.WithIdentity, DefinitionStages.WithSku, DefinitionStages.WithCacheSizeGB, - DefinitionStages.WithProvisioningState, DefinitionStages.WithSubnet, - DefinitionStages.WithUpgradeStatus, DefinitionStages.WithNetworkSettings, DefinitionStages.WithEncryptionSettings, DefinitionStages.WithSecuritySettings, @@ -271,18 +270,6 @@ interface WithCacheSizeGB { */ WithCreate withCacheSizeGB(Integer cacheSizeGB); } - /** The stage of the Cache definition allowing to specify provisioningState. */ - interface WithProvisioningState { - /** - * Specifies the provisioningState property: ARM provisioning state, see - * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/Addendum.md#provisioningstate-property. - * - * @param provisioningState ARM provisioning state, see - * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/Addendum.md#provisioningstate-property. - * @return the next definition stage. - */ - WithCreate withProvisioningState(ProvisioningStateType provisioningState); - } /** The stage of the Cache definition allowing to specify subnet. */ interface WithSubnet { /** @@ -293,16 +280,6 @@ interface WithSubnet { */ WithCreate withSubnet(String subnet); } - /** The stage of the Cache definition allowing to specify upgradeStatus. */ - interface WithUpgradeStatus { - /** - * Specifies the upgradeStatus property: Upgrade status of the Cache.. - * - * @param upgradeStatus Upgrade status of the Cache. - * @return the next definition stage. - */ - WithCreate withUpgradeStatus(CacheUpgradeStatus upgradeStatus); - } /** The stage of the Cache definition allowing to specify networkSettings. */ interface WithNetworkSettings { /** @@ -355,11 +332,6 @@ interface WithDirectoryServicesSettings { interface Update extends UpdateStages.WithTags, UpdateStages.WithIdentity, - UpdateStages.WithSku, - UpdateStages.WithCacheSizeGB, - UpdateStages.WithProvisioningState, - UpdateStages.WithSubnet, - UpdateStages.WithUpgradeStatus, UpdateStages.WithNetworkSettings, UpdateStages.WithEncryptionSettings, UpdateStages.WithSecuritySettings, @@ -401,58 +373,6 @@ interface WithIdentity { */ Update withIdentity(CacheIdentity identity); } - /** The stage of the Cache update allowing to specify sku. */ - interface WithSku { - /** - * Specifies the sku property: SKU for the Cache.. - * - * @param sku SKU for the Cache. - * @return the next definition stage. - */ - Update withSku(CacheSku sku); - } - /** The stage of the Cache update allowing to specify cacheSizeGB. */ - interface WithCacheSizeGB { - /** - * Specifies the cacheSizeGB property: The size of this Cache, in GB.. - * - * @param cacheSizeGB The size of this Cache, in GB. - * @return the next definition stage. - */ - Update withCacheSizeGB(Integer cacheSizeGB); - } - /** The stage of the Cache update allowing to specify provisioningState. */ - interface WithProvisioningState { - /** - * Specifies the provisioningState property: ARM provisioning state, see - * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/Addendum.md#provisioningstate-property. - * - * @param provisioningState ARM provisioning state, see - * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/Addendum.md#provisioningstate-property. - * @return the next definition stage. - */ - Update withProvisioningState(ProvisioningStateType provisioningState); - } - /** The stage of the Cache update allowing to specify subnet. */ - interface WithSubnet { - /** - * Specifies the subnet property: Subnet used for the Cache.. - * - * @param subnet Subnet used for the Cache. - * @return the next definition stage. - */ - Update withSubnet(String subnet); - } - /** The stage of the Cache update allowing to specify upgradeStatus. */ - interface WithUpgradeStatus { - /** - * Specifies the upgradeStatus property: Upgrade status of the Cache.. - * - * @param upgradeStatus Upgrade status of the Cache. - * @return the next definition stage. - */ - Update withUpgradeStatus(CacheUpgradeStatus upgradeStatus); - } /** The stage of the Cache update allowing to specify networkSettings. */ interface WithNetworkSettings { /** diff --git a/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/CacheEncryptionSettings.java b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/CacheEncryptionSettings.java index 0ada57c44aa9..e434531d2b19 100644 --- a/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/CacheEncryptionSettings.java +++ b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/CacheEncryptionSettings.java @@ -20,6 +20,13 @@ public final class CacheEncryptionSettings { @JsonProperty(value = "keyEncryptionKey") private KeyVaultKeyReference keyEncryptionKey; + /* + * Specifies whether the service will automatically rotate to the newest + * version of the key in the Key Vault. + */ + @JsonProperty(value = "rotationToLatestKeyVersionEnabled") + private Boolean rotationToLatestKeyVersionEnabled; + /** * Get the keyEncryptionKey property: Specifies the location of the key encryption key in Key Vault. * @@ -40,6 +47,28 @@ public CacheEncryptionSettings withKeyEncryptionKey(KeyVaultKeyReference keyEncr return this; } + /** + * Get the rotationToLatestKeyVersionEnabled property: Specifies whether the service will automatically rotate to + * the newest version of the key in the Key Vault. + * + * @return the rotationToLatestKeyVersionEnabled value. + */ + public Boolean rotationToLatestKeyVersionEnabled() { + return this.rotationToLatestKeyVersionEnabled; + } + + /** + * Set the rotationToLatestKeyVersionEnabled property: Specifies whether the service will automatically rotate to + * the newest version of the key in the Key Vault. + * + * @param rotationToLatestKeyVersionEnabled the rotationToLatestKeyVersionEnabled value to set. + * @return the CacheEncryptionSettings object itself. + */ + public CacheEncryptionSettings withRotationToLatestKeyVersionEnabled(Boolean rotationToLatestKeyVersionEnabled) { + this.rotationToLatestKeyVersionEnabled = rotationToLatestKeyVersionEnabled; + return this; + } + /** * Validates the instance. * diff --git a/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/CacheIdentity.java b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/CacheIdentity.java index a1cf41231003..dcb61d3ea8c6 100644 --- a/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/CacheIdentity.java +++ b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/CacheIdentity.java @@ -8,6 +8,7 @@ import com.azure.core.util.logging.ClientLogger; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; /** Cache identity properties. */ @Fluent @@ -15,13 +16,13 @@ public class CacheIdentity { @JsonIgnore private final ClientLogger logger = new ClientLogger(CacheIdentity.class); /* - * The principal id of the cache. + * The principal ID for the system-assigned identity of the cache. */ @JsonProperty(value = "principalId", access = JsonProperty.Access.WRITE_ONLY) private String principalId; /* - * The tenant id associated with the cache. + * The tenant ID associated with the cache. */ @JsonProperty(value = "tenantId", access = JsonProperty.Access.WRITE_ONLY) private String tenantId; @@ -32,8 +33,15 @@ public class CacheIdentity { @JsonProperty(value = "type") private CacheIdentityType type; + /* + * A dictionary where each key is a user assigned identity resource ID, and + * each key's value is an empty dictionary. + */ + @JsonProperty(value = "userAssignedIdentities") + private Map userAssignedIdentities; + /** - * Get the principalId property: The principal id of the cache. + * Get the principalId property: The principal ID for the system-assigned identity of the cache. * * @return the principalId value. */ @@ -42,7 +50,7 @@ public String principalId() { } /** - * Get the tenantId property: The tenant id associated with the cache. + * Get the tenantId property: The tenant ID associated with the cache. * * @return the tenantId value. */ @@ -70,11 +78,43 @@ public CacheIdentity withType(CacheIdentityType type) { return this; } + /** + * Get the userAssignedIdentities property: A dictionary where each key is a user assigned identity resource ID, and + * each key's value is an empty dictionary. + * + * @return the userAssignedIdentities value. + */ + public Map userAssignedIdentities() { + return this.userAssignedIdentities; + } + + /** + * Set the userAssignedIdentities property: A dictionary where each key is a user assigned identity resource ID, and + * each key's value is an empty dictionary. + * + * @param userAssignedIdentities the userAssignedIdentities value to set. + * @return the CacheIdentity object itself. + */ + public CacheIdentity withUserAssignedIdentities(Map userAssignedIdentities) { + this.userAssignedIdentities = userAssignedIdentities; + return this; + } + /** * Validates the instance. * * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { + if (userAssignedIdentities() != null) { + userAssignedIdentities() + .values() + .forEach( + e -> { + if (e != null) { + e.validate(); + } + }); + } } } diff --git a/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/CacheIdentityType.java b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/CacheIdentityType.java index 83fa0092d53f..6ac4bc15ee87 100644 --- a/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/CacheIdentityType.java +++ b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/CacheIdentityType.java @@ -12,6 +12,12 @@ public enum CacheIdentityType { /** Enum value SystemAssigned. */ SYSTEM_ASSIGNED("SystemAssigned"), + /** Enum value UserAssigned. */ + USER_ASSIGNED("UserAssigned"), + + /** Enum value SystemAssigned, UserAssigned. */ + SYSTEM_ASSIGNED_USER_ASSIGNED("SystemAssigned, UserAssigned"), + /** Enum value None. */ NONE("None"); diff --git a/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/CreatedByType.java b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/CreatedByType.java deleted file mode 100644 index e8c4ecd76cd1..000000000000 --- a/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/CreatedByType.java +++ /dev/null @@ -1,40 +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.storagecache.models; - -import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; -import java.util.Collection; - -/** Defines values for CreatedByType. */ -public final class CreatedByType extends ExpandableStringEnum { - /** Static value User for CreatedByType. */ - public static final CreatedByType USER = fromString("User"); - - /** Static value Application for CreatedByType. */ - public static final CreatedByType APPLICATION = fromString("Application"); - - /** Static value ManagedIdentity for CreatedByType. */ - public static final CreatedByType MANAGED_IDENTITY = fromString("ManagedIdentity"); - - /** Static value Key for CreatedByType. */ - public static final CreatedByType KEY = fromString("Key"); - - /** - * Creates or finds a CreatedByType from its string representation. - * - * @param name a name to look for. - * @return the corresponding CreatedByType. - */ - @JsonCreator - public static CreatedByType fromString(String name) { - return fromString(name, CreatedByType.class); - } - - /** @return known CreatedByType values. */ - public static Collection values() { - return values(CreatedByType.class); - } -} diff --git a/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/StorageTarget.java b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/StorageTarget.java index 22d33e7f08aa..c65e11e1afc0 100644 --- a/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/StorageTarget.java +++ b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/StorageTarget.java @@ -5,6 +5,7 @@ package com.azure.resourcemanager.storagecache.models; import com.azure.core.management.Region; +import com.azure.core.management.SystemData; import com.azure.core.util.Context; import com.azure.resourcemanager.storagecache.fluent.models.StorageTargetInner; import java.util.List; @@ -145,7 +146,6 @@ interface WithParentResource { interface WithCreate extends DefinitionStages.WithJunctions, DefinitionStages.WithTargetType, - DefinitionStages.WithProvisioningState, DefinitionStages.WithNfs3, DefinitionStages.WithClfs, DefinitionStages.WithUnknown, @@ -186,18 +186,6 @@ interface WithTargetType { */ WithCreate withTargetType(StorageTargetType targetType); } - /** The stage of the StorageTarget definition allowing to specify provisioningState. */ - interface WithProvisioningState { - /** - * Specifies the provisioningState property: ARM provisioning state, see - * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/Addendum.md#provisioningstate-property. - * - * @param provisioningState ARM provisioning state, see - * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/Addendum.md#provisioningstate-property. - * @return the next definition stage. - */ - WithCreate withProvisioningState(ProvisioningStateType provisioningState); - } /** The stage of the StorageTarget definition allowing to specify nfs3. */ interface WithNfs3 { /** @@ -249,8 +237,6 @@ interface WithBlobNfs { /** The template for StorageTarget update. */ interface Update extends UpdateStages.WithJunctions, - UpdateStages.WithTargetType, - UpdateStages.WithProvisioningState, UpdateStages.WithNfs3, UpdateStages.WithClfs, UpdateStages.WithUnknown, @@ -283,28 +269,6 @@ interface WithJunctions { */ Update withJunctions(List junctions); } - /** The stage of the StorageTarget update allowing to specify targetType. */ - interface WithTargetType { - /** - * Specifies the targetType property: Type of the Storage Target.. - * - * @param targetType Type of the Storage Target. - * @return the next definition stage. - */ - Update withTargetType(StorageTargetType targetType); - } - /** The stage of the StorageTarget update allowing to specify provisioningState. */ - interface WithProvisioningState { - /** - * Specifies the provisioningState property: ARM provisioning state, see - * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/Addendum.md#provisioningstate-property. - * - * @param provisioningState ARM provisioning state, see - * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/Addendum.md#provisioningstate-property. - * @return the next definition stage. - */ - Update withProvisioningState(ProvisioningStateType provisioningState); - } /** The stage of the StorageTarget update allowing to specify nfs3. */ interface WithNfs3 { /** diff --git a/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/StorageTargetOperations.java b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/StorageTargetOperations.java new file mode 100644 index 000000000000..fb9aae132ae7 --- /dev/null +++ b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/StorageTargetOperations.java @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagecache.models; + +import com.azure.core.util.Context; + +/** Resource collection API of StorageTargetOperations. */ +public interface StorageTargetOperations { + /** + * Tells the cache to write all dirty data to the Storage Target's backend storage. Client requests to this storage + * target's namespace will return errors until the flush operation completes. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @param storageTargetName Name of Storage Target. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void flush(String resourceGroupName, String cacheName, String storageTargetName); + + /** + * Tells the cache to write all dirty data to the Storage Target's backend storage. Client requests to this storage + * target's namespace will return errors until the flush operation completes. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @param storageTargetName Name of Storage Target. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void flush(String resourceGroupName, String cacheName, String storageTargetName, Context context); + + /** + * Suspends client access to a storage target. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @param storageTargetName Name of Storage Target. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void suspend(String resourceGroupName, String cacheName, String storageTargetName); + + /** + * Suspends client access to a storage target. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @param storageTargetName Name of Storage Target. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void suspend(String resourceGroupName, String cacheName, String storageTargetName, Context context); + + /** + * Resumes client access to a previously suspended storage target. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @param storageTargetName Name of Storage Target. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void resume(String resourceGroupName, String cacheName, String storageTargetName); + + /** + * Resumes client access to a previously suspended storage target. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @param storageTargetName Name of Storage Target. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void resume(String resourceGroupName, String cacheName, String storageTargetName, Context context); +} diff --git a/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/StorageTargetResource.java b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/StorageTargetResource.java index a401a278414f..f46de4d13646 100644 --- a/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/StorageTargetResource.java +++ b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/StorageTargetResource.java @@ -6,6 +6,7 @@ import com.azure.core.annotation.Immutable; import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; import com.azure.core.util.logging.ClientLogger; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; @@ -51,8 +52,5 @@ public SystemData systemData() { * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { - if (systemData() != null) { - systemData().validate(); - } } } diff --git a/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/StorageTargets.java b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/StorageTargets.java index 5d61d9a4bbab..484e0f09154a 100644 --- a/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/StorageTargets.java +++ b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/StorageTargets.java @@ -64,6 +64,24 @@ public interface StorageTargets { */ PagedIterable listByCache(String resourceGroupName, String cacheName, Context context); + /** + * Removes a Storage Target from a Cache. This operation is allowed at any time, but if the Cache is down or + * unhealthy, the actual removal of the Storage Target may be delayed until the Cache is healthy again. Note that if + * the Cache has data to flush to the Storage Target, the data will be flushed before the Storage Target will be + * deleted. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the + * [-0-9a-zA-Z_] char class. + * @param storageTargetName Name of Storage Target. + * @param force Boolean value requesting the force delete operation for a storage target. Force delete discards + * unwritten-data in the cache instead of flushing it to back-end storage. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String cacheName, String storageTargetName, String force); + /** * Removes a Storage Target from a Cache. This operation is allowed at any time, but if the Cache is down or * unhealthy, the actual removal of the Storage Target may be delayed until the Cache is healthy again. Note that if @@ -90,12 +108,14 @@ public interface StorageTargets { * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the * [-0-9a-zA-Z_] char class. * @param storageTargetName Name of Storage Target. + * @param force Boolean value requesting the force delete operation for a storage target. Force delete discards + * unwritten-data in the cache instead of flushing it to back-end storage. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. */ - void delete(String resourceGroupName, String cacheName, String storageTargetName, Context context); + void delete(String resourceGroupName, String cacheName, String storageTargetName, String force, Context context); /** * Returns a Storage Target from a Cache. @@ -170,12 +190,14 @@ Response getWithResponse( * deleted. * * @param id the resource ID. + * @param force Boolean value requesting the force delete operation for a storage target. Force delete discards + * unwritten-data in the cache instead of flushing it to back-end storage. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. */ - void deleteByIdWithResponse(String id, Context context); + void deleteByIdWithResponse(String id, String force, Context context); /** * Begins definition for a new StorageTarget resource. diff --git a/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/SystemData.java b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/SystemData.java deleted file mode 100644 index 74174e1fd8bd..000000000000 --- a/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/SystemData.java +++ /dev/null @@ -1,181 +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.storagecache.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.util.logging.ClientLogger; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; -import java.time.OffsetDateTime; - -/** Metadata pertaining to creation and last modification of the resource. */ -@Fluent -public final class SystemData { - @JsonIgnore private final ClientLogger logger = new ClientLogger(SystemData.class); - - /* - * The identity that created the resource. - */ - @JsonProperty(value = "createdBy") - private String createdBy; - - /* - * The type of identity that created the resource. - */ - @JsonProperty(value = "createdByType") - private CreatedByType createdByType; - - /* - * The timestamp of resource creation (UTC). - */ - @JsonProperty(value = "createdAt") - private OffsetDateTime createdAt; - - /* - * The identity that last modified the resource. - */ - @JsonProperty(value = "lastModifiedBy") - private String lastModifiedBy; - - /* - * The type of identity that last modified the resource. - */ - @JsonProperty(value = "lastModifiedByType") - private CreatedByType lastModifiedByType; - - /* - * The timestamp of resource last modification (UTC) - */ - @JsonProperty(value = "lastModifiedAt") - private OffsetDateTime lastModifiedAt; - - /** - * Get the createdBy property: The identity that created the resource. - * - * @return the createdBy value. - */ - public String createdBy() { - return this.createdBy; - } - - /** - * Set the createdBy property: The identity that created the resource. - * - * @param createdBy the createdBy value to set. - * @return the SystemData object itself. - */ - public SystemData withCreatedBy(String createdBy) { - this.createdBy = createdBy; - return this; - } - - /** - * Get the createdByType property: The type of identity that created the resource. - * - * @return the createdByType value. - */ - public CreatedByType createdByType() { - return this.createdByType; - } - - /** - * Set the createdByType property: The type of identity that created the resource. - * - * @param createdByType the createdByType value to set. - * @return the SystemData object itself. - */ - public SystemData withCreatedByType(CreatedByType createdByType) { - this.createdByType = createdByType; - return this; - } - - /** - * Get the createdAt property: The timestamp of resource creation (UTC). - * - * @return the createdAt value. - */ - public OffsetDateTime createdAt() { - return this.createdAt; - } - - /** - * Set the createdAt property: The timestamp of resource creation (UTC). - * - * @param createdAt the createdAt value to set. - * @return the SystemData object itself. - */ - public SystemData withCreatedAt(OffsetDateTime createdAt) { - this.createdAt = createdAt; - return this; - } - - /** - * Get the lastModifiedBy property: The identity that last modified the resource. - * - * @return the lastModifiedBy value. - */ - public String lastModifiedBy() { - return this.lastModifiedBy; - } - - /** - * Set the lastModifiedBy property: The identity that last modified the resource. - * - * @param lastModifiedBy the lastModifiedBy value to set. - * @return the SystemData object itself. - */ - public SystemData withLastModifiedBy(String lastModifiedBy) { - this.lastModifiedBy = lastModifiedBy; - return this; - } - - /** - * Get the lastModifiedByType property: The type of identity that last modified the resource. - * - * @return the lastModifiedByType value. - */ - public CreatedByType lastModifiedByType() { - return this.lastModifiedByType; - } - - /** - * Set the lastModifiedByType property: The type of identity that last modified the resource. - * - * @param lastModifiedByType the lastModifiedByType value to set. - * @return the SystemData object itself. - */ - public SystemData withLastModifiedByType(CreatedByType lastModifiedByType) { - this.lastModifiedByType = lastModifiedByType; - return this; - } - - /** - * Get the lastModifiedAt property: The timestamp of resource last modification (UTC). - * - * @return the lastModifiedAt value. - */ - public OffsetDateTime lastModifiedAt() { - return this.lastModifiedAt; - } - - /** - * Set the lastModifiedAt property: The timestamp of resource last modification (UTC). - * - * @param lastModifiedAt the lastModifiedAt value to set. - * @return the SystemData object itself. - */ - public SystemData withLastModifiedAt(OffsetDateTime lastModifiedAt) { - this.lastModifiedAt = lastModifiedAt; - return this; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - } -} diff --git a/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/UserAssignedIdentitiesValue.java b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/UserAssignedIdentitiesValue.java new file mode 100644 index 000000000000..17f2550463a4 --- /dev/null +++ b/sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/models/UserAssignedIdentitiesValue.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storagecache.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The UserAssignedIdentitiesValue model. */ +@Immutable +public final class UserAssignedIdentitiesValue { + @JsonIgnore private final ClientLogger logger = new ClientLogger(UserAssignedIdentitiesValue.class); + + /* + * The principal ID of the user-assigned identity. + */ + @JsonProperty(value = "principalId", access = JsonProperty.Access.WRITE_ONLY) + private String principalId; + + /* + * The client ID of the user-assigned identity. + */ + @JsonProperty(value = "clientId", access = JsonProperty.Access.WRITE_ONLY) + private String clientId; + + /** + * Get the principalId property: The principal ID of the user-assigned identity. + * + * @return the principalId value. + */ + public String principalId() { + return this.principalId; + } + + /** + * Get the clientId property: The client ID of the user-assigned identity. + * + * @return the clientId value. + */ + public String clientId() { + return this.clientId; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +}