diff --git a/sdk/storagecache/mgmt-v2020_03_01/pom.xml b/sdk/storagecache/mgmt-v2020_03_01/pom.xml index aa8c1bdb69fe..9c5ec4cb01bb 100644 --- a/sdk/storagecache/mgmt-v2020_03_01/pom.xml +++ b/sdk/storagecache/mgmt-v2020_03_01/pom.xml @@ -11,8 +11,8 @@ com.microsoft.azure azure-arm-parent - 1.3.0 - ../../parents/azure-arm-parent + 1.1.0 + ../../../pom.management.xml azure-mgmt-storagecache 1.0.0-beta diff --git a/sdk/storagecache/mgmt-v2020_03_01/src/main/java/com/microsoft/azure/management/storagecache/v2020_03_01/AscOperation.java b/sdk/storagecache/mgmt-v2020_03_01/src/main/java/com/microsoft/azure/management/storagecache/v2020_03_01/AscOperation.java new file mode 100644 index 000000000000..e584af2d1194 --- /dev/null +++ b/sdk/storagecache/mgmt-v2020_03_01/src/main/java/com/microsoft/azure/management/storagecache/v2020_03_01/AscOperation.java @@ -0,0 +1,52 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.storagecache.v2020_03_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.storagecache.v2020_03_01.implementation.AscOperationInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.storagecache.v2020_03_01.implementation.StorageCacheManager; + +/** + * Type representing AscOperation. + */ +public interface AscOperation extends HasInner, Indexable, Refreshable, HasManager { + /** + * @return the endTime value. + */ + String endTime(); + + /** + * @return the error value. + */ + ErrorResponse error(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the startTime value. + */ + String startTime(); + + /** + * @return the status value. + */ + String status(); + +} diff --git a/sdk/storagecache/mgmt-v2020_03_01/src/main/java/com/microsoft/azure/management/storagecache/v2020_03_01/AscOperations.java b/sdk/storagecache/mgmt-v2020_03_01/src/main/java/com/microsoft/azure/management/storagecache/v2020_03_01/AscOperations.java new file mode 100644 index 000000000000..efe2d4be7882 --- /dev/null +++ b/sdk/storagecache/mgmt-v2020_03_01/src/main/java/com/microsoft/azure/management/storagecache/v2020_03_01/AscOperations.java @@ -0,0 +1,29 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.storagecache.v2020_03_01; + +import rx.Observable; +import com.microsoft.azure.management.storagecache.v2020_03_01.implementation.AscOperationsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing AscOperations. + */ +public interface AscOperations extends HasInner { + /** + * Gets the status of an asynchronous operation for the Azure HPC cache. + * + * @param location The region name which the operation will lookup into. + * @param operationId The operation id which uniquely identifies the asynchronous operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String location, String operationId); + +} diff --git a/sdk/storagecache/mgmt-v2020_03_01/src/main/java/com/microsoft/azure/management/storagecache/v2020_03_01/ErrorResponse.java b/sdk/storagecache/mgmt-v2020_03_01/src/main/java/com/microsoft/azure/management/storagecache/v2020_03_01/ErrorResponse.java new file mode 100644 index 000000000000..b981877af6d7 --- /dev/null +++ b/sdk/storagecache/mgmt-v2020_03_01/src/main/java/com/microsoft/azure/management/storagecache/v2020_03_01/ErrorResponse.java @@ -0,0 +1,69 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.storagecache.v2020_03_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Describes the format of Error response. + */ +public class ErrorResponse { + /** + * Error code. + */ + @JsonProperty(value = "code") + private String code; + + /** + * Error message indicating why the operation failed. + */ + @JsonProperty(value = "message") + private String message; + + /** + * Get error code. + * + * @return the code value + */ + public String code() { + return this.code; + } + + /** + * Set error code. + * + * @param code the code value to set + * @return the ErrorResponse object itself. + */ + public ErrorResponse withCode(String code) { + this.code = code; + return this; + } + + /** + * Get error message indicating why the operation failed. + * + * @return the message value + */ + public String message() { + return this.message; + } + + /** + * Set error message indicating why the operation failed. + * + * @param message the message value to set + * @return the ErrorResponse object itself. + */ + public ErrorResponse withMessage(String message) { + this.message = message; + return this; + } + +} diff --git a/sdk/storagecache/mgmt-v2020_03_01/src/main/java/com/microsoft/azure/management/storagecache/v2020_03_01/implementation/AscOperationImpl.java b/sdk/storagecache/mgmt-v2020_03_01/src/main/java/com/microsoft/azure/management/storagecache/v2020_03_01/implementation/AscOperationImpl.java new file mode 100644 index 000000000000..a47677a53cba --- /dev/null +++ b/sdk/storagecache/mgmt-v2020_03_01/src/main/java/com/microsoft/azure/management/storagecache/v2020_03_01/implementation/AscOperationImpl.java @@ -0,0 +1,72 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.storagecache.v2020_03_01.implementation; + +import com.microsoft.azure.management.storagecache.v2020_03_01.AscOperation; +import com.microsoft.azure.arm.model.implementation.IndexableRefreshableWrapperImpl; +import rx.Observable; +import com.microsoft.azure.management.storagecache.v2020_03_01.ErrorResponse; + +class AscOperationImpl extends IndexableRefreshableWrapperImpl implements AscOperation { + private final StorageCacheManager manager; + private String location; + private String operationId; + + AscOperationImpl(AscOperationInner inner, StorageCacheManager manager) { + super(null, inner); + this.manager = manager; + // set resource ancestor and positional variables + this.location = IdParsingUtils.getValueFromIdByName(inner.id(), "locations"); + this.operationId = IdParsingUtils.getValueFromIdByName(inner.id(), "ascOperations"); + } + + @Override + public StorageCacheManager manager() { + return this.manager; + } + + @Override + protected Observable getInnerAsync() { + AscOperationsInner client = this.manager().inner().ascOperations(); + return client.getAsync(this.location, this.operationId); + } + + + + @Override + public String endTime() { + return this.inner().endTime(); + } + + @Override + public ErrorResponse error() { + return this.inner().error(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String startTime() { + return this.inner().startTime(); + } + + @Override + public String status() { + return this.inner().status(); + } + +} diff --git a/sdk/storagecache/mgmt-v2020_03_01/src/main/java/com/microsoft/azure/management/storagecache/v2020_03_01/implementation/AscOperationInner.java b/sdk/storagecache/mgmt-v2020_03_01/src/main/java/com/microsoft/azure/management/storagecache/v2020_03_01/implementation/AscOperationInner.java new file mode 100644 index 000000000000..2a4be5350d5f --- /dev/null +++ b/sdk/storagecache/mgmt-v2020_03_01/src/main/java/com/microsoft/azure/management/storagecache/v2020_03_01/implementation/AscOperationInner.java @@ -0,0 +1,174 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.storagecache.v2020_03_01.implementation; + +import com.microsoft.azure.management.storagecache.v2020_03_01.ErrorResponse; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The status of operation. + */ +public class AscOperationInner { + /** + * The operation Id. + */ + @JsonProperty(value = "id") + private String id; + + /** + * The operation name. + */ + @JsonProperty(value = "name") + private String name; + + /** + * The start time of the operation. + */ + @JsonProperty(value = "startTime") + private String startTime; + + /** + * The end time of the operation. + */ + @JsonProperty(value = "endTime") + private String endTime; + + /** + * The status of the operation. + */ + @JsonProperty(value = "status") + private String status; + + /** + * The error detail of the operation if any. + */ + @JsonProperty(value = "error") + private ErrorResponse error; + + /** + * Get the operation Id. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Set the operation Id. + * + * @param id the id value to set + * @return the AscOperationInner object itself. + */ + public AscOperationInner withId(String id) { + this.id = id; + return this; + } + + /** + * Get the operation name. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the operation name. + * + * @param name the name value to set + * @return the AscOperationInner object itself. + */ + public AscOperationInner withName(String name) { + this.name = name; + return this; + } + + /** + * Get the start time of the operation. + * + * @return the startTime value + */ + public String startTime() { + return this.startTime; + } + + /** + * Set the start time of the operation. + * + * @param startTime the startTime value to set + * @return the AscOperationInner object itself. + */ + public AscOperationInner withStartTime(String startTime) { + this.startTime = startTime; + return this; + } + + /** + * Get the end time of the operation. + * + * @return the endTime value + */ + public String endTime() { + return this.endTime; + } + + /** + * Set the end time of the operation. + * + * @param endTime the endTime value to set + * @return the AscOperationInner object itself. + */ + public AscOperationInner withEndTime(String endTime) { + this.endTime = endTime; + return this; + } + + /** + * Get the status of the operation. + * + * @return the status value + */ + public String status() { + return this.status; + } + + /** + * Set the status of the operation. + * + * @param status the status value to set + * @return the AscOperationInner object itself. + */ + public AscOperationInner withStatus(String status) { + this.status = status; + return this; + } + + /** + * Get the error detail of the operation if any. + * + * @return the error value + */ + public ErrorResponse error() { + return this.error; + } + + /** + * Set the error detail of the operation if any. + * + * @param error the error value to set + * @return the AscOperationInner object itself. + */ + public AscOperationInner withError(ErrorResponse error) { + this.error = error; + return this; + } + +} diff --git a/sdk/storagecache/mgmt-v2020_03_01/src/main/java/com/microsoft/azure/management/storagecache/v2020_03_01/implementation/AscOperationsImpl.java b/sdk/storagecache/mgmt-v2020_03_01/src/main/java/com/microsoft/azure/management/storagecache/v2020_03_01/implementation/AscOperationsImpl.java new file mode 100644 index 000000000000..3660fa11274f --- /dev/null +++ b/sdk/storagecache/mgmt-v2020_03_01/src/main/java/com/microsoft/azure/management/storagecache/v2020_03_01/implementation/AscOperationsImpl.java @@ -0,0 +1,50 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * + */ + +package com.microsoft.azure.management.storagecache.v2020_03_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.storagecache.v2020_03_01.AscOperations; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.management.storagecache.v2020_03_01.AscOperation; + +class AscOperationsImpl extends WrapperImpl implements AscOperations { + private final StorageCacheManager manager; + + AscOperationsImpl(StorageCacheManager manager) { + super(manager.inner().ascOperations()); + this.manager = manager; + } + + public StorageCacheManager manager() { + return this.manager; + } + + private AscOperationImpl wrapModel(AscOperationInner inner) { + return new AscOperationImpl(inner, manager()); + } + + @Override + public Observable getAsync(String location, String operationId) { + AscOperationsInner client = this.inner(); + return client.getAsync(location, operationId) + .flatMap(new Func1>() { + @Override + public Observable call(AscOperationInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((AscOperation)wrapModel(inner)); + } + } + }); + } + +} diff --git a/sdk/storagecache/mgmt-v2020_03_01/src/main/java/com/microsoft/azure/management/storagecache/v2020_03_01/implementation/AscOperationsInner.java b/sdk/storagecache/mgmt-v2020_03_01/src/main/java/com/microsoft/azure/management/storagecache/v2020_03_01/implementation/AscOperationsInner.java new file mode 100644 index 000000000000..8c8f424c3e8b --- /dev/null +++ b/sdk/storagecache/mgmt-v2020_03_01/src/main/java/com/microsoft/azure/management/storagecache/v2020_03_01/implementation/AscOperationsInner.java @@ -0,0 +1,146 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.storagecache.v2020_03_01.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.CloudException; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in AscOperations. + */ +public class AscOperationsInner { + /** The Retrofit service to perform REST calls. */ + private AscOperationsService service; + /** The service client containing this operation class. */ + private StorageCacheManagementClientImpl client; + + /** + * Initializes an instance of AscOperationsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public AscOperationsInner(Retrofit retrofit, StorageCacheManagementClientImpl client) { + this.service = retrofit.create(AscOperationsService.class); + this.client = client; + } + + /** + * The interface defining all the services for AscOperations to be + * used by Retrofit to perform actually REST calls. + */ + interface AscOperationsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.storagecache.v2020_03_01.AscOperations get" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.StorageCache/locations/{location}/ascOperations/{operationId}") + Observable> get(@Path("subscriptionId") String subscriptionId, @Path("location") String location, @Path("operationId") String operationId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets the status of an asynchronous operation for the Azure HPC cache. + * + * @param location The region name which the operation will lookup into. + * @param operationId The operation id which uniquely identifies the asynchronous operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the AscOperationInner object if successful. + */ + public AscOperationInner get(String location, String operationId) { + return getWithServiceResponseAsync(location, operationId).toBlocking().single().body(); + } + + /** + * Gets the status of an asynchronous operation for the Azure HPC cache. + * + * @param location The region name which the operation will lookup into. + * @param operationId The operation id which uniquely identifies the asynchronous operation. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAsync(String location, String operationId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(location, operationId), serviceCallback); + } + + /** + * Gets the status of an asynchronous operation for the Azure HPC cache. + * + * @param location The region name which the operation will lookup into. + * @param operationId The operation id which uniquely identifies the asynchronous operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AscOperationInner object + */ + public Observable getAsync(String location, String operationId) { + return getWithServiceResponseAsync(location, operationId).map(new Func1, AscOperationInner>() { + @Override + public AscOperationInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the status of an asynchronous operation for the Azure HPC cache. + * + * @param location The region name which the operation will lookup into. + * @param operationId The operation id which uniquely identifies the asynchronous operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AscOperationInner object + */ + public Observable> getWithServiceResponseAsync(String location, String operationId) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (location == null) { + throw new IllegalArgumentException("Parameter location is required and cannot be null."); + } + if (operationId == null) { + throw new IllegalArgumentException("Parameter operationId is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.get(this.client.subscriptionId(), location, operationId, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/sdk/storagecache/mgmt-v2020_03_01/src/main/java/com/microsoft/azure/management/storagecache/v2020_03_01/implementation/StorageCacheManagementClientImpl.java b/sdk/storagecache/mgmt-v2020_03_01/src/main/java/com/microsoft/azure/management/storagecache/v2020_03_01/implementation/StorageCacheManagementClientImpl.java index 312eac834bcb..1a0cb7eec67a 100644 --- a/sdk/storagecache/mgmt-v2020_03_01/src/main/java/com/microsoft/azure/management/storagecache/v2020_03_01/implementation/StorageCacheManagementClientImpl.java +++ b/sdk/storagecache/mgmt-v2020_03_01/src/main/java/com/microsoft/azure/management/storagecache/v2020_03_01/implementation/StorageCacheManagementClientImpl.java @@ -173,6 +173,19 @@ public UsageModelsInner usageModels() { return this.usageModels; } + /** + * The AscOperationsInner object to access its operations. + */ + private AscOperationsInner ascOperations; + + /** + * Gets the AscOperationsInner object to access its operations. + * @return the AscOperationsInner object. + */ + public AscOperationsInner ascOperations() { + return this.ascOperations; + } + /** * The CachesInner object to access its operations. */ @@ -237,6 +250,7 @@ protected void initialize() { this.operations = new OperationsInner(restClient().retrofit(), this); this.skus = new SkusInner(restClient().retrofit(), this); this.usageModels = new UsageModelsInner(restClient().retrofit(), this); + this.ascOperations = new AscOperationsInner(restClient().retrofit(), this); this.caches = new CachesInner(restClient().retrofit(), this); this.storageTargets = new StorageTargetsInner(restClient().retrofit(), this); this.azureClient = new AzureClient(this); diff --git a/sdk/storagecache/mgmt-v2020_03_01/src/main/java/com/microsoft/azure/management/storagecache/v2020_03_01/implementation/StorageCacheManager.java b/sdk/storagecache/mgmt-v2020_03_01/src/main/java/com/microsoft/azure/management/storagecache/v2020_03_01/implementation/StorageCacheManager.java index a85861682453..0fbe374def8d 100644 --- a/sdk/storagecache/mgmt-v2020_03_01/src/main/java/com/microsoft/azure/management/storagecache/v2020_03_01/implementation/StorageCacheManager.java +++ b/sdk/storagecache/mgmt-v2020_03_01/src/main/java/com/microsoft/azure/management/storagecache/v2020_03_01/implementation/StorageCacheManager.java @@ -19,6 +19,7 @@ import com.microsoft.azure.management.storagecache.v2020_03_01.Operations; import com.microsoft.azure.management.storagecache.v2020_03_01.Skus; import com.microsoft.azure.management.storagecache.v2020_03_01.UsageModels; +import com.microsoft.azure.management.storagecache.v2020_03_01.AscOperations; import com.microsoft.azure.management.storagecache.v2020_03_01.Caches; import com.microsoft.azure.management.storagecache.v2020_03_01.StorageTargets; import com.microsoft.azure.arm.resources.implementation.AzureConfigurableCoreImpl; @@ -31,6 +32,7 @@ public final class StorageCacheManager extends ManagerCore