use of com.ecwid.consul.v1.Response in project azure-sdk-for-java by Azure.
the class StorageAccountsInner method checkNameAvailabilityWithServiceResponseAsync.
/**
* Checks that the storage account name is valid and is not already in use.
*
* @param name the String value
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the CheckNameAvailabilityResultInner object
*/
public Observable<ServiceResponse<CheckNameAvailabilityResultInner>> checkNameAvailabilityWithServiceResponseAsync(String name) {
if (this.client.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
}
if (this.client.apiVersion() == null) {
throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
}
if (name == null) {
throw new IllegalArgumentException("Parameter name is required and cannot be null.");
}
StorageAccountCheckNameAvailabilityParameters accountName = new StorageAccountCheckNameAvailabilityParameters();
accountName.withName(name);
return service.checkNameAvailability(this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), accountName, this.client.userAgent()).flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<CheckNameAvailabilityResultInner>>>() {
@Override
public Observable<ServiceResponse<CheckNameAvailabilityResultInner>> call(Response<ResponseBody> response) {
try {
ServiceResponse<CheckNameAvailabilityResultInner> clientResponse = checkNameAvailabilityDelegate(response);
return Observable.just(clientResponse);
} catch (Throwable t) {
return Observable.error(t);
}
}
});
}
use of com.ecwid.consul.v1.Response in project Gradle-demo by Arisono.
the class OkhttpUtils method sendGetHttp.
/**
* get http
* @param url
* @param tag
*/
public static void sendGetHttp(String url, Map<String, Object> params, String cookies, String tag) {
StringBuilder buf = new StringBuilder(url);
if (params != null) {
if (!params.isEmpty()) {
if (url.indexOf("?") == -1)
buf.append("?");
else if (!url.endsWith("&"))
buf.append("&");
Iterator<Map.Entry<String, Object>> entries = params.entrySet().iterator();
while (entries.hasNext()) {
Map.Entry<String, Object> entry = entries.next();
buf.append(String.valueOf(entry.getKey())).append("=").append(String.valueOf(entry.getValue())).append("&");
}
buf.deleteCharAt(buf.length() - 1);
}
}
Request request = new Request.Builder().url(buf.toString()).addHeader("content-type", "text/html;charset:utf-8").addHeader("Cookie", "12").build();
OkhttpUtils.println(tag + ":" + buf.toString());
OkhttpUtils.client.newCall(request).enqueue(new Callback() {
@Override
public void onResponse(Call call, Response response) throws IOException {
String requestJson;
requestJson = OkhttpUtils.getResponseString(response);
OkhttpUtils.println(requestJson);
RxBus.getInstance().send(tag + ":" + requestJson);
}
@Override
public void onFailure(Call call, IOException e) {
OkhttpUtils.onFailurePrintln(call, e, this);
}
});
}
use of com.ecwid.consul.v1.Response in project Gradle-demo by Arisono.
the class RetryIntercepter method intercept.
@SuppressWarnings("resource")
@Override
public Response intercept(Chain chain) throws IOException {
Request request = chain.request();
Response response = chain.proceed(request);
try {
// OkhttpUtils.println("重试拦截器:"+response.isSuccessful());
while (!response.isSuccessful() && retryNum < maxRetry) {
retryNum++;
response = chain.proceed(request);
}
} catch (ConnectException e) {
OkhttpUtils.println("服务器拒绝连接.....");
} catch (IOException e) {
OkhttpUtils.println("服务器拒绝连接.....");
}
return response;
}
use of com.ecwid.consul.v1.Response in project azure-sdk-for-java by Azure.
the class EndpointsInner method purgeContentWithServiceResponseAsync.
/**
* Removes a content from CDN.
*
* @param resourceGroupName Name of the Resource group within the Azure subscription.
* @param profileName Name of the CDN profile which is unique within the resource group.
* @param endpointName Name of the endpoint under the profile which is unique globally.
* @param contentPaths The path to the content to be purged. Can describe a file path or a wild card directory.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable for the request
*/
public Observable<ServiceResponse<Void>> purgeContentWithServiceResponseAsync(String resourceGroupName, String profileName, String endpointName, List<String> contentPaths) {
if (resourceGroupName == null) {
throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
}
if (profileName == null) {
throw new IllegalArgumentException("Parameter profileName is required and cannot be null.");
}
if (endpointName == null) {
throw new IllegalArgumentException("Parameter endpointName is required and cannot be null.");
}
if (this.client.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
}
if (this.client.apiVersion() == null) {
throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
}
if (contentPaths == null) {
throw new IllegalArgumentException("Parameter contentPaths is required and cannot be null.");
}
Validator.validate(contentPaths);
PurgeParameters contentFilePaths = new PurgeParameters();
contentFilePaths.withContentPaths(contentPaths);
Observable<Response<ResponseBody>> observable = service.purgeContent(resourceGroupName, profileName, endpointName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), contentFilePaths, this.client.userAgent());
return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken<Void>() {
}.getType());
}
use of com.ecwid.consul.v1.Response in project azure-sdk-for-java by Azure.
the class ProfilesInner method beginUpdateWithServiceResponseAsync.
/**
* Updates an existing CDN profile with the specified profile name under the specified subscription and resource group.
*
* @param resourceGroupName Name of the Resource group within the Azure subscription.
* @param profileName Name of the CDN profile which is unique within the resource group.
* @param tags Profile tags
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the ProfileInner object
*/
public Observable<ServiceResponse<ProfileInner>> beginUpdateWithServiceResponseAsync(String resourceGroupName, String profileName, Map<String, String> tags) {
if (resourceGroupName == null) {
throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
}
if (profileName == null) {
throw new IllegalArgumentException("Parameter profileName is required and cannot be null.");
}
if (this.client.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
}
if (this.client.apiVersion() == null) {
throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
}
if (tags == null) {
throw new IllegalArgumentException("Parameter tags is required and cannot be null.");
}
Validator.validate(tags);
ProfileUpdateParameters profileUpdateParameters = new ProfileUpdateParameters();
profileUpdateParameters.withTags(tags);
return service.beginUpdate(resourceGroupName, profileName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), profileUpdateParameters, this.client.userAgent()).flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<ProfileInner>>>() {
@Override
public Observable<ServiceResponse<ProfileInner>> call(Response<ResponseBody> response) {
try {
ServiceResponse<ProfileInner> clientResponse = beginUpdateDelegate(response);
return Observable.just(clientResponse);
} catch (Throwable t) {
return Observable.error(t);
}
}
});
}
Aggregations