Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AutoPR sdk/resources/mgmt-v2020_06_01] Add new api-version of policy for go SDK #4930

Closed
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
4 changes: 2 additions & 2 deletions sdk/resources/mgmt-v2020_06_01/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
<parent>
<groupId>com.microsoft.azure</groupId>
<artifactId>azure-arm-parent</artifactId>
<version>1.3.2</version>
<relativePath>../../parents/azure-arm-parent/pom.xml</relativePath>
<version>1.1.0</version>
<relativePath>../../../pom.management.xml</relativePath>
</parent>
<artifactId>azure-mgmt-resources</artifactId>
<version>1.0.0-beta</version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
package com.microsoft.azure.management.resources.v2020_06_01;

import rx.Observable;
import rx.Completable;
import com.microsoft.azure.management.resources.v2020_06_01.implementation.ProvidersInner;
import com.microsoft.azure.arm.model.HasInner;

Expand All @@ -25,6 +26,16 @@ public interface Providers extends HasInner<ProvidersInner> {
*/
Observable<Provider> unregisterAsync(String resourceProviderNamespace);

/**
* Registers a management group with a resource provider.
*
* @param resourceProviderNamespace The namespace of the resource provider to register.
* @param groupId The management group ID.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable for the request
*/
Completable registerAtManagementGroupScopeAsync(String resourceProviderNamespace, String groupId);

/**
* Registers a subscription with a resource provider.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import rx.Observable;
import rx.functions.Func1;
import com.microsoft.azure.Page;
import rx.Completable;
import com.microsoft.azure.management.resources.v2020_06_01.Provider;

class ProvidersImpl extends WrapperImpl<ProvidersInner> implements Providers {
Expand Down Expand Up @@ -44,6 +45,12 @@ public Provider call(ProviderInner inner) {
});
}

@Override
public Completable registerAtManagementGroupScopeAsync(String resourceProviderNamespace, String groupId) {
ProvidersInner client = this.inner();
return client.registerAtManagementGroupScopeAsync(resourceProviderNamespace, groupId).toCompletable();
}

@Override
public Observable<Provider> registerAsync(String resourceProviderNamespace) {
ProvidersInner client = this.inner();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ interface ProvidersService {
@POST("subscriptions/{subscriptionId}/providers/{resourceProviderNamespace}/unregister")
Observable<Response<ResponseBody>> unregister(@Path("resourceProviderNamespace") String resourceProviderNamespace, @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.resources.v2020_06_01.Providers registerAtManagementGroupScope" })
@POST("providers/Microsoft.Management/managementGroups/{groupId}/providers/{resourceProviderNamespace}/register")
Observable<Response<ResponseBody>> registerAtManagementGroupScope(@Path("resourceProviderNamespace") String resourceProviderNamespace, @Path("groupId") String groupId, @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.resources.v2020_06_01.Providers register" })
@POST("subscriptions/{subscriptionId}/providers/{resourceProviderNamespace}/register")
Observable<Response<ResponseBody>> register(@Path("resourceProviderNamespace") String resourceProviderNamespace, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);
Expand Down Expand Up @@ -171,6 +175,88 @@ private ServiceResponse<ProviderInner> unregisterDelegate(Response<ResponseBody>
.build(response);
}

/**
* Registers a management group with a resource provider.
*
* @param resourceProviderNamespace The namespace of the resource provider to register.
* @param groupId The management group ID.
* @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
*/
public void registerAtManagementGroupScope(String resourceProviderNamespace, String groupId) {
registerAtManagementGroupScopeWithServiceResponseAsync(resourceProviderNamespace, groupId).toBlocking().single().body();
}

/**
* Registers a management group with a resource provider.
*
* @param resourceProviderNamespace The namespace of the resource provider to register.
* @param groupId The management group ID.
* @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<Void> registerAtManagementGroupScopeAsync(String resourceProviderNamespace, String groupId, final ServiceCallback<Void> serviceCallback) {
return ServiceFuture.fromResponse(registerAtManagementGroupScopeWithServiceResponseAsync(resourceProviderNamespace, groupId), serviceCallback);
}

/**
* Registers a management group with a resource provider.
*
* @param resourceProviderNamespace The namespace of the resource provider to register.
* @param groupId The management group ID.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the {@link ServiceResponse} object if successful.
*/
public Observable<Void> registerAtManagementGroupScopeAsync(String resourceProviderNamespace, String groupId) {
return registerAtManagementGroupScopeWithServiceResponseAsync(resourceProviderNamespace, groupId).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
}

/**
* Registers a management group with a resource provider.
*
* @param resourceProviderNamespace The namespace of the resource provider to register.
* @param groupId The management group ID.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the {@link ServiceResponse} object if successful.
*/
public Observable<ServiceResponse<Void>> registerAtManagementGroupScopeWithServiceResponseAsync(String resourceProviderNamespace, String groupId) {
if (resourceProviderNamespace == null) {
throw new IllegalArgumentException("Parameter resourceProviderNamespace is required and cannot be null.");
}
if (groupId == null) {
throw new IllegalArgumentException("Parameter groupId 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.registerAtManagementGroupScope(resourceProviderNamespace, groupId, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Void>>>() {
@Override
public Observable<ServiceResponse<Void>> call(Response<ResponseBody> response) {
try {
ServiceResponse<Void> clientResponse = registerAtManagementGroupScopeDelegate(response);
return Observable.just(clientResponse);
} catch (Throwable t) {
return Observable.error(t);
}
}
});
}

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

/**
* Registers a subscription with a resource provider.
*
Expand Down