-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[AutoPR graphrbac/data-plane] Add service principals by app id micros…
…oft.graph rbac (#3140) * Generated from 9f615cc6b8f1dd194512f725b3e6655314c95e1e Merge branch 'master' of https://github.com/Azure/azure-rest-api-specs into add-servicePrincipalsByAppId-Microsoft.GraphRbac * Generated from cec3f8a6bcad7e1b69f227281eb1a984180a4090 Update graphrbac.json * Generated from 1ba20d49c738fb00f7e75e227c3ab92d9c7be54d Update graphrbac.json * Generated from 6afb048f96472417e5cadf45df930eb381f4ad3b Update graphrbac.json
- Loading branch information
1 parent
4d330d7
commit 6a99669
Showing
3 changed files
with
288 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
70 changes: 70 additions & 0 deletions
70
.../java/com/microsoft/azure/graphrbac/implementation/ServicePrincipalObjectResultInner.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
/** | ||
* 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.graphrbac.implementation; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
|
||
/** | ||
* Service Principal Object Result. | ||
*/ | ||
public class ServicePrincipalObjectResultInner { | ||
/** | ||
* The Object ID of the service principal with the specified application | ||
* ID. | ||
*/ | ||
@JsonProperty(value = "value") | ||
private String value; | ||
|
||
/** | ||
* The URL representing edm equivalent. | ||
*/ | ||
@JsonProperty(value = "odata\\.metadata") | ||
private String odatametadata; | ||
|
||
/** | ||
* Get the Object ID of the service principal with the specified application ID. | ||
* | ||
* @return the value value | ||
*/ | ||
public String value() { | ||
return this.value; | ||
} | ||
|
||
/** | ||
* Set the Object ID of the service principal with the specified application ID. | ||
* | ||
* @param value the value value to set | ||
* @return the ServicePrincipalObjectResultInner object itself. | ||
*/ | ||
public ServicePrincipalObjectResultInner withValue(String value) { | ||
this.value = value; | ||
return this; | ||
} | ||
|
||
/** | ||
* Get the URL representing edm equivalent. | ||
* | ||
* @return the odatametadata value | ||
*/ | ||
public String odatametadata() { | ||
return this.odatametadata; | ||
} | ||
|
||
/** | ||
* Set the URL representing edm equivalent. | ||
* | ||
* @param odatametadata the odatametadata value to set | ||
* @return the ServicePrincipalObjectResultInner object itself. | ||
*/ | ||
public ServicePrincipalObjectResultInner withOdatametadata(String odatametadata) { | ||
this.odatametadata = odatametadata; | ||
return this; | ||
} | ||
|
||
} |
135 changes: 135 additions & 0 deletions
135
...ain/java/com/microsoft/azure/graphrbac/implementation/ServicePrincipalsByAppIdsInner.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,135 @@ | ||
/** | ||
* 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.graphrbac.implementation; | ||
|
||
import retrofit2.Retrofit; | ||
import com.google.common.reflect.TypeToken; | ||
import com.microsoft.azure.graphrbac.GraphErrorException; | ||
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 ServicePrincipalsByAppIds. | ||
*/ | ||
public class ServicePrincipalsByAppIdsInner { | ||
/** The Retrofit service to perform REST calls. */ | ||
private ServicePrincipalsByAppIdsService service; | ||
/** The service client containing this operation class. */ | ||
private GraphRbacManagementClientImpl client; | ||
|
||
/** | ||
* Initializes an instance of ServicePrincipalsByAppIdsInner. | ||
* | ||
* @param retrofit the Retrofit instance built from a Retrofit Builder. | ||
* @param client the instance of the service client containing this operation class. | ||
*/ | ||
public ServicePrincipalsByAppIdsInner(Retrofit retrofit, GraphRbacManagementClientImpl client) { | ||
this.service = retrofit.create(ServicePrincipalsByAppIdsService.class); | ||
this.client = client; | ||
} | ||
|
||
/** | ||
* The interface defining all the services for ServicePrincipalsByAppIds to be | ||
* used by Retrofit to perform actually REST calls. | ||
*/ | ||
interface ServicePrincipalsByAppIdsService { | ||
@Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.graphrbac.ServicePrincipalsByAppIds get" }) | ||
@GET("{tenantID}/servicePrincipalsByAppId/{applicationID}/objectId") | ||
Observable<Response<ResponseBody>> get(@Path("tenantID") String tenantID, @Path("applicationID") String applicationID, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); | ||
|
||
} | ||
|
||
/** | ||
* Gets an object id for a given application id from the current tenant. | ||
* | ||
* @throws IllegalArgumentException thrown if parameters fail the validation | ||
* @throws GraphErrorException thrown if the request is rejected by server | ||
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent | ||
* @return the ServicePrincipalObjectResultInner object if successful. | ||
*/ | ||
public ServicePrincipalObjectResultInner get() { | ||
return getWithServiceResponseAsync().toBlocking().single().body(); | ||
} | ||
|
||
/** | ||
* Gets an object id for a given application id from the current tenant. | ||
* | ||
* @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<ServicePrincipalObjectResultInner> getAsync(final ServiceCallback<ServicePrincipalObjectResultInner> serviceCallback) { | ||
return ServiceFuture.fromResponse(getWithServiceResponseAsync(), serviceCallback); | ||
} | ||
|
||
/** | ||
* Gets an object id for a given application id from the current tenant. | ||
* | ||
* @throws IllegalArgumentException thrown if parameters fail the validation | ||
* @return the observable to the ServicePrincipalObjectResultInner object | ||
*/ | ||
public Observable<ServicePrincipalObjectResultInner> getAsync() { | ||
return getWithServiceResponseAsync().map(new Func1<ServiceResponse<ServicePrincipalObjectResultInner>, ServicePrincipalObjectResultInner>() { | ||
@Override | ||
public ServicePrincipalObjectResultInner call(ServiceResponse<ServicePrincipalObjectResultInner> response) { | ||
return response.body(); | ||
} | ||
}); | ||
} | ||
|
||
/** | ||
* Gets an object id for a given application id from the current tenant. | ||
* | ||
* @throws IllegalArgumentException thrown if parameters fail the validation | ||
* @return the observable to the ServicePrincipalObjectResultInner object | ||
*/ | ||
public Observable<ServiceResponse<ServicePrincipalObjectResultInner>> getWithServiceResponseAsync() { | ||
if (this.client.tenantID() == null) { | ||
throw new IllegalArgumentException("Parameter this.client.tenantID() is required and cannot be null."); | ||
} | ||
if (this.client.applicationID() == null) { | ||
throw new IllegalArgumentException("Parameter this.client.applicationID() 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.tenantID(), this.client.applicationID(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) | ||
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<ServicePrincipalObjectResultInner>>>() { | ||
@Override | ||
public Observable<ServiceResponse<ServicePrincipalObjectResultInner>> call(Response<ResponseBody> response) { | ||
try { | ||
ServiceResponse<ServicePrincipalObjectResultInner> clientResponse = getDelegate(response); | ||
return Observable.just(clientResponse); | ||
} catch (Throwable t) { | ||
return Observable.error(t); | ||
} | ||
} | ||
}); | ||
} | ||
|
||
private ServiceResponse<ServicePrincipalObjectResultInner> getDelegate(Response<ResponseBody> response) throws GraphErrorException, IOException, IllegalArgumentException { | ||
return this.client.restClient().responseBuilderFactory().<ServicePrincipalObjectResultInner, GraphErrorException>newInstance(this.client.serializerAdapter()) | ||
.register(200, new TypeToken<ServicePrincipalObjectResultInner>() { }.getType()) | ||
.registerError(GraphErrorException.class) | ||
.build(response); | ||
} | ||
|
||
} |