Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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.redis;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;

/**
* Defines values for DefaultName.
*/
public enum DefaultName {
/** Enum value Microsoft.Cache/redis. */
MICROSOFT_CACHEREDIS("Microsoft.Cache/redis");

/** The actual serialized value for a DefaultName instance. */
private String value;

DefaultName(String value) {
this.value = value;
}

/**
* Parses a serialized value to a DefaultName instance.
*
* @param value the serialized value to parse.
* @return the parsed DefaultName object, or null if unable to parse.
*/
@JsonCreator
public static DefaultName fromString(String value) {
DefaultName[] items = DefaultName.values();
for (DefaultName item : items) {
if (item.toString().equalsIgnoreCase(value)) {
return item;
}
}
return null;
}

@JsonValue
@Override
public String toString() {
return this.value;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,20 @@
import com.fasterxml.jackson.annotation.JsonProperty;

/**
* Parameters body to pass for name availability check.
* Parameters body to pass for resource name availability check.
*/
public class CheckNameAvailabilityParametersInner {
/**
* Resource name.
*/
@JsonProperty(value = "name")
@JsonProperty(value = "name", required = true)
private String name;

/**
* Resource type.
* Resource type. The only legal value of this property for checking redis
* cache name availability is 'Microsoft.Cache/redis'.
*/
@JsonProperty(value = "type")
@JsonProperty(value = "type", required = true)
private String type;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@
import com.microsoft.azure.management.resources.fluentcore.collection.InnerSupportsDelete;
import retrofit2.Retrofit;
import com.google.common.reflect.TypeToken;
import com.microsoft.azure.AzureServiceFuture;
import com.microsoft.azure.CloudException;
import com.microsoft.azure.ListOperationCallback;
import com.microsoft.azure.Page;
import com.microsoft.azure.PagedList;
import com.microsoft.rest.ServiceCallback;
import com.microsoft.rest.ServiceFuture;
import com.microsoft.rest.ServiceResponse;
Expand All @@ -27,6 +31,7 @@
import retrofit2.http.Path;
import retrofit2.http.PUT;
import retrofit2.http.Query;
import retrofit2.http.Url;
import retrofit2.Response;
import rx.functions.Func1;
import rx.Observable;
Expand Down Expand Up @@ -57,6 +62,10 @@ public PatchSchedulesInner(Retrofit retrofit, RedisManagementClientImpl client)
* used by Retrofit to perform actually REST calls.
*/
interface PatchSchedulesService {
@Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.redis.PatchSchedules listByRedisResource" })
@GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/Redis/{cacheName}/patchSchedules")
Observable<Response<ResponseBody>> listByRedisResource(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("cacheName") String cacheName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);

@Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.redis.PatchSchedules createOrUpdate" })
@PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/Redis/{name}/patchSchedules/{default}")
Observable<Response<ResponseBody>> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("name") String name, @Path("default") String defaultParameter, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body RedisPatchScheduleInner parameters, @Header("User-Agent") String userAgent);
Expand All @@ -69,6 +78,133 @@ interface PatchSchedulesService {
@GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/Redis/{name}/patchSchedules/{default}")
Observable<Response<ResponseBody>> get(@Path("resourceGroupName") String resourceGroupName, @Path("name") String name, @Path("default") String defaultParameter, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);

@Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.redis.PatchSchedules listByRedisResourceNext" })
@GET
Observable<Response<ResponseBody>> listByRedisResourceNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);

}

/**
* Gets all patch schedules in the specified redis cache (there is only one).
*
* @param resourceGroupName The name of the resource group.
* @param cacheName The name of the Redis cache.
* @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 PagedList&lt;RedisPatchScheduleInner&gt; object if successful.
*/
public PagedList<RedisPatchScheduleInner> listByRedisResource(final String resourceGroupName, final String cacheName) {
ServiceResponse<Page<RedisPatchScheduleInner>> response = listByRedisResourceSinglePageAsync(resourceGroupName, cacheName).toBlocking().single();
return new PagedList<RedisPatchScheduleInner>(response.body()) {
@Override
public Page<RedisPatchScheduleInner> nextPage(String nextPageLink) {
return listByRedisResourceNextSinglePageAsync(nextPageLink).toBlocking().single().body();
}
};
}

/**
* Gets all patch schedules in the specified redis cache (there is only one).
*
* @param resourceGroupName The name of the resource group.
* @param cacheName The name of the Redis cache.
* @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<List<RedisPatchScheduleInner>> listByRedisResourceAsync(final String resourceGroupName, final String cacheName, final ListOperationCallback<RedisPatchScheduleInner> serviceCallback) {
return AzureServiceFuture.fromPageResponse(
listByRedisResourceSinglePageAsync(resourceGroupName, cacheName),
new Func1<String, Observable<ServiceResponse<Page<RedisPatchScheduleInner>>>>() {
@Override
public Observable<ServiceResponse<Page<RedisPatchScheduleInner>>> call(String nextPageLink) {
return listByRedisResourceNextSinglePageAsync(nextPageLink);
}
},
serviceCallback);
}

/**
* Gets all patch schedules in the specified redis cache (there is only one).
*
* @param resourceGroupName The name of the resource group.
* @param cacheName The name of the Redis cache.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the PagedList&lt;RedisPatchScheduleInner&gt; object
*/
public Observable<Page<RedisPatchScheduleInner>> listByRedisResourceAsync(final String resourceGroupName, final String cacheName) {
return listByRedisResourceWithServiceResponseAsync(resourceGroupName, cacheName)
.map(new Func1<ServiceResponse<Page<RedisPatchScheduleInner>>, Page<RedisPatchScheduleInner>>() {
@Override
public Page<RedisPatchScheduleInner> call(ServiceResponse<Page<RedisPatchScheduleInner>> response) {
return response.body();
}
});
}

/**
* Gets all patch schedules in the specified redis cache (there is only one).
*
* @param resourceGroupName The name of the resource group.
* @param cacheName The name of the Redis cache.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the PagedList&lt;RedisPatchScheduleInner&gt; object
*/
public Observable<ServiceResponse<Page<RedisPatchScheduleInner>>> listByRedisResourceWithServiceResponseAsync(final String resourceGroupName, final String cacheName) {
return listByRedisResourceSinglePageAsync(resourceGroupName, cacheName)
.concatMap(new Func1<ServiceResponse<Page<RedisPatchScheduleInner>>, Observable<ServiceResponse<Page<RedisPatchScheduleInner>>>>() {
@Override
public Observable<ServiceResponse<Page<RedisPatchScheduleInner>>> call(ServiceResponse<Page<RedisPatchScheduleInner>> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page);
}
return Observable.just(page).concatWith(listByRedisResourceNextWithServiceResponseAsync(nextPageLink));
}
});
}

/**
* Gets all patch schedules in the specified redis cache (there is only one).
*
ServiceResponse<PageImpl<RedisPatchScheduleInner>> * @param resourceGroupName The name of the resource group.
ServiceResponse<PageImpl<RedisPatchScheduleInner>> * @param cacheName The name of the Redis cache.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the PagedList&lt;RedisPatchScheduleInner&gt; object wrapped in {@link ServiceResponse} if successful.
*/
public Observable<ServiceResponse<Page<RedisPatchScheduleInner>>> listByRedisResourceSinglePageAsync(final String resourceGroupName, final String cacheName) {
if (this.client.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
}
if (resourceGroupName == null) {
throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
}
if (cacheName == null) {
throw new IllegalArgumentException("Parameter cacheName 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.listByRedisResource(this.client.subscriptionId(), resourceGroupName, cacheName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Page<RedisPatchScheduleInner>>>>() {
@Override
public Observable<ServiceResponse<Page<RedisPatchScheduleInner>>> call(Response<ResponseBody> response) {
try {
ServiceResponse<PageImpl<RedisPatchScheduleInner>> result = listByRedisResourceDelegate(response);
return Observable.just(new ServiceResponse<Page<RedisPatchScheduleInner>>(result.body(), result.response()));
} catch (Throwable t) {
return Observable.error(t);
}
}
});
}

private ServiceResponse<PageImpl<RedisPatchScheduleInner>> listByRedisResourceDelegate(Response<ResponseBody> response) throws CloudException, IOException, IllegalArgumentException {
return this.client.restClient().responseBuilderFactory().<PageImpl<RedisPatchScheduleInner>, CloudException>newInstance(this.client.serializerAdapter())
.register(200, new TypeToken<PageImpl<RedisPatchScheduleInner>>() { }.getType())
.registerError(CloudException.class)
.build(response);
}

/**
Expand Down Expand Up @@ -343,4 +479,115 @@ private ServiceResponse<RedisPatchScheduleInner> getDelegate(Response<ResponseBo
.build(response);
}

/**
* Gets all patch schedules in the specified redis cache (there is only one).
*
* @param nextPageLink The NextLink from the previous successful call to List 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 PagedList&lt;RedisPatchScheduleInner&gt; object if successful.
*/
public PagedList<RedisPatchScheduleInner> listByRedisResourceNext(final String nextPageLink) {
ServiceResponse<Page<RedisPatchScheduleInner>> response = listByRedisResourceNextSinglePageAsync(nextPageLink).toBlocking().single();
return new PagedList<RedisPatchScheduleInner>(response.body()) {
@Override
public Page<RedisPatchScheduleInner> nextPage(String nextPageLink) {
return listByRedisResourceNextSinglePageAsync(nextPageLink).toBlocking().single().body();
}
};
}

/**
* Gets all patch schedules in the specified redis cache (there is only one).
*
* @param nextPageLink The NextLink from the previous successful call to List operation.
* @param serviceFuture the ServiceFuture object tracking the Retrofit calls
* @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<List<RedisPatchScheduleInner>> listByRedisResourceNextAsync(final String nextPageLink, final ServiceFuture<List<RedisPatchScheduleInner>> serviceFuture, final ListOperationCallback<RedisPatchScheduleInner> serviceCallback) {
return AzureServiceFuture.fromPageResponse(
listByRedisResourceNextSinglePageAsync(nextPageLink),
new Func1<String, Observable<ServiceResponse<Page<RedisPatchScheduleInner>>>>() {
@Override
public Observable<ServiceResponse<Page<RedisPatchScheduleInner>>> call(String nextPageLink) {
return listByRedisResourceNextSinglePageAsync(nextPageLink);
}
},
serviceCallback);
}

/**
* Gets all patch schedules in the specified redis cache (there is only one).
*
* @param nextPageLink The NextLink from the previous successful call to List operation.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the PagedList&lt;RedisPatchScheduleInner&gt; object
*/
public Observable<Page<RedisPatchScheduleInner>> listByRedisResourceNextAsync(final String nextPageLink) {
return listByRedisResourceNextWithServiceResponseAsync(nextPageLink)
.map(new Func1<ServiceResponse<Page<RedisPatchScheduleInner>>, Page<RedisPatchScheduleInner>>() {
@Override
public Page<RedisPatchScheduleInner> call(ServiceResponse<Page<RedisPatchScheduleInner>> response) {
return response.body();
}
});
}

/**
* Gets all patch schedules in the specified redis cache (there is only one).
*
* @param nextPageLink The NextLink from the previous successful call to List operation.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the PagedList&lt;RedisPatchScheduleInner&gt; object
*/
public Observable<ServiceResponse<Page<RedisPatchScheduleInner>>> listByRedisResourceNextWithServiceResponseAsync(final String nextPageLink) {
return listByRedisResourceNextSinglePageAsync(nextPageLink)
.concatMap(new Func1<ServiceResponse<Page<RedisPatchScheduleInner>>, Observable<ServiceResponse<Page<RedisPatchScheduleInner>>>>() {
@Override
public Observable<ServiceResponse<Page<RedisPatchScheduleInner>>> call(ServiceResponse<Page<RedisPatchScheduleInner>> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page);
}
return Observable.just(page).concatWith(listByRedisResourceNextWithServiceResponseAsync(nextPageLink));
}
});
}

/**
* Gets all patch schedules in the specified redis cache (there is only one).
*
ServiceResponse<PageImpl<RedisPatchScheduleInner>> * @param nextPageLink The NextLink from the previous successful call to List operation.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the PagedList&lt;RedisPatchScheduleInner&gt; object wrapped in {@link ServiceResponse} if successful.
*/
public Observable<ServiceResponse<Page<RedisPatchScheduleInner>>> listByRedisResourceNextSinglePageAsync(final String nextPageLink) {
if (nextPageLink == null) {
throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.");
}
String nextUrl = String.format("%s", nextPageLink);
return service.listByRedisResourceNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Page<RedisPatchScheduleInner>>>>() {
@Override
public Observable<ServiceResponse<Page<RedisPatchScheduleInner>>> call(Response<ResponseBody> response) {
try {
ServiceResponse<PageImpl<RedisPatchScheduleInner>> result = listByRedisResourceNextDelegate(response);
return Observable.just(new ServiceResponse<Page<RedisPatchScheduleInner>>(result.body(), result.response()));
} catch (Throwable t) {
return Observable.error(t);
}
}
});
}

private ServiceResponse<PageImpl<RedisPatchScheduleInner>> listByRedisResourceNextDelegate(Response<ResponseBody> response) throws CloudException, IOException, IllegalArgumentException {
return this.client.restClient().responseBuilderFactory().<PageImpl<RedisPatchScheduleInner>, CloudException>newInstance(this.client.serializerAdapter())
.register(200, new TypeToken<PageImpl<RedisPatchScheduleInner>>() { }.getType())
.registerError(CloudException.class)
.build(response);
}

}
Loading