diff --git a/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/ApplicationAddOwnerParameters.java b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/ApplicationAddOwnerParameters.java new file mode 100644 index 000000000000..e02bc2f0ddf3 --- /dev/null +++ b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/ApplicationAddOwnerParameters.java @@ -0,0 +1,74 @@ +/** + * 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; + +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Request parameters for adding a owner to an application. + */ +public class ApplicationAddOwnerParameters { + /** + * Unmatched properties from the message are deserialized this collection. + */ + @JsonProperty(value = "") + private Map additionalProperties; + + /** + * A owner object URL, such as + * "https://graph.windows.net/0b1f9851-1bf0-433f-aec3-cb9272f093dc/directoryObjects/f260bbc4-c254-447b-94cf-293b5ec434dd", + * where "0b1f9851-1bf0-433f-aec3-cb9272f093dc" is the tenantId and + * "f260bbc4-c254-447b-94cf-293b5ec434dd" is the objectId of the owner + * (user, application, servicePrincipal, group) to be added. + */ + @JsonProperty(value = "url", required = true) + private String url; + + /** + * Get unmatched properties from the message are deserialized this collection. + * + * @return the additionalProperties value + */ + public Map additionalProperties() { + return this.additionalProperties; + } + + /** + * Set unmatched properties from the message are deserialized this collection. + * + * @param additionalProperties the additionalProperties value to set + * @return the ApplicationAddOwnerParameters object itself. + */ + public ApplicationAddOwnerParameters withAdditionalProperties(Map additionalProperties) { + this.additionalProperties = additionalProperties; + return this; + } + + /** + * Get a owner object URL, such as "https://graph.windows.net/0b1f9851-1bf0-433f-aec3-cb9272f093dc/directoryObjects/f260bbc4-c254-447b-94cf-293b5ec434dd", where "0b1f9851-1bf0-433f-aec3-cb9272f093dc" is the tenantId and "f260bbc4-c254-447b-94cf-293b5ec434dd" is the objectId of the owner (user, application, servicePrincipal, group) to be added. + * + * @return the url value + */ + public String url() { + return this.url; + } + + /** + * Set a owner object URL, such as "https://graph.windows.net/0b1f9851-1bf0-433f-aec3-cb9272f093dc/directoryObjects/f260bbc4-c254-447b-94cf-293b5ec434dd", where "0b1f9851-1bf0-433f-aec3-cb9272f093dc" is the tenantId and "f260bbc4-c254-447b-94cf-293b5ec434dd" is the objectId of the owner (user, application, servicePrincipal, group) to be added. + * + * @param url the url value to set + * @return the ApplicationAddOwnerParameters object itself. + */ + public ApplicationAddOwnerParameters withUrl(String url) { + this.url = url; + return this; + } + +} diff --git a/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/ApplicationCreateParameters.java b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/ApplicationCreateParameters.java new file mode 100644 index 000000000000..7f2dfd632896 --- /dev/null +++ b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/ApplicationCreateParameters.java @@ -0,0 +1,284 @@ +/** + * 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; + +import java.util.Map; +import java.util.List; +import com.microsoft.azure.graphrbac.implementation.KeyCredentialInner; +import com.microsoft.azure.graphrbac.implementation.PasswordCredentialInner; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Request parameters for creating a new application. + */ +public class ApplicationCreateParameters { + /** + * Unmatched properties from the message are deserialized this collection. + */ + @JsonProperty(value = "") + private Map additionalProperties; + + /** + * Whether the application is available to other tenants. + */ + @JsonProperty(value = "availableToOtherTenants", required = true) + private boolean availableToOtherTenants; + + /** + * The display name of the application. + */ + @JsonProperty(value = "displayName", required = true) + private String displayName; + + /** + * The home page of the application. + */ + @JsonProperty(value = "homepage") + private String homepage; + + /** + * A collection of URIs for the application. + */ + @JsonProperty(value = "identifierUris", required = true) + private List identifierUris; + + /** + * A collection of reply URLs for the application. + */ + @JsonProperty(value = "replyUrls") + private List replyUrls; + + /** + * The list of KeyCredential objects. + */ + @JsonProperty(value = "keyCredentials") + private List keyCredentials; + + /** + * The list of PasswordCredential objects. + */ + @JsonProperty(value = "passwordCredentials") + private List passwordCredentials; + + /** + * Whether to allow implicit grant flow for OAuth2. + */ + @JsonProperty(value = "oauth2AllowImplicitFlow") + private Boolean oauth2AllowImplicitFlow; + + /** + * Specifies resources that this application requires access to and the set + * of OAuth permission scopes and application roles that it needs under + * each of those resources. This pre-configuration of required resource + * access drives the consent experience. + */ + @JsonProperty(value = "requiredResourceAccess") + private List requiredResourceAccess; + + /** + * Get unmatched properties from the message are deserialized this collection. + * + * @return the additionalProperties value + */ + public Map additionalProperties() { + return this.additionalProperties; + } + + /** + * Set unmatched properties from the message are deserialized this collection. + * + * @param additionalProperties the additionalProperties value to set + * @return the ApplicationCreateParameters object itself. + */ + public ApplicationCreateParameters withAdditionalProperties(Map additionalProperties) { + this.additionalProperties = additionalProperties; + return this; + } + + /** + * Get whether the application is available to other tenants. + * + * @return the availableToOtherTenants value + */ + public boolean availableToOtherTenants() { + return this.availableToOtherTenants; + } + + /** + * Set whether the application is available to other tenants. + * + * @param availableToOtherTenants the availableToOtherTenants value to set + * @return the ApplicationCreateParameters object itself. + */ + public ApplicationCreateParameters withAvailableToOtherTenants(boolean availableToOtherTenants) { + this.availableToOtherTenants = availableToOtherTenants; + return this; + } + + /** + * Get the display name of the application. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the display name of the application. + * + * @param displayName the displayName value to set + * @return the ApplicationCreateParameters object itself. + */ + public ApplicationCreateParameters withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the home page of the application. + * + * @return the homepage value + */ + public String homepage() { + return this.homepage; + } + + /** + * Set the home page of the application. + * + * @param homepage the homepage value to set + * @return the ApplicationCreateParameters object itself. + */ + public ApplicationCreateParameters withHomepage(String homepage) { + this.homepage = homepage; + return this; + } + + /** + * Get a collection of URIs for the application. + * + * @return the identifierUris value + */ + public List identifierUris() { + return this.identifierUris; + } + + /** + * Set a collection of URIs for the application. + * + * @param identifierUris the identifierUris value to set + * @return the ApplicationCreateParameters object itself. + */ + public ApplicationCreateParameters withIdentifierUris(List identifierUris) { + this.identifierUris = identifierUris; + return this; + } + + /** + * Get a collection of reply URLs for the application. + * + * @return the replyUrls value + */ + public List replyUrls() { + return this.replyUrls; + } + + /** + * Set a collection of reply URLs for the application. + * + * @param replyUrls the replyUrls value to set + * @return the ApplicationCreateParameters object itself. + */ + public ApplicationCreateParameters withReplyUrls(List replyUrls) { + this.replyUrls = replyUrls; + return this; + } + + /** + * Get the list of KeyCredential objects. + * + * @return the keyCredentials value + */ + public List keyCredentials() { + return this.keyCredentials; + } + + /** + * Set the list of KeyCredential objects. + * + * @param keyCredentials the keyCredentials value to set + * @return the ApplicationCreateParameters object itself. + */ + public ApplicationCreateParameters withKeyCredentials(List keyCredentials) { + this.keyCredentials = keyCredentials; + return this; + } + + /** + * Get the list of PasswordCredential objects. + * + * @return the passwordCredentials value + */ + public List passwordCredentials() { + return this.passwordCredentials; + } + + /** + * Set the list of PasswordCredential objects. + * + * @param passwordCredentials the passwordCredentials value to set + * @return the ApplicationCreateParameters object itself. + */ + public ApplicationCreateParameters withPasswordCredentials(List passwordCredentials) { + this.passwordCredentials = passwordCredentials; + return this; + } + + /** + * Get whether to allow implicit grant flow for OAuth2. + * + * @return the oauth2AllowImplicitFlow value + */ + public Boolean oauth2AllowImplicitFlow() { + return this.oauth2AllowImplicitFlow; + } + + /** + * Set whether to allow implicit grant flow for OAuth2. + * + * @param oauth2AllowImplicitFlow the oauth2AllowImplicitFlow value to set + * @return the ApplicationCreateParameters object itself. + */ + public ApplicationCreateParameters withOauth2AllowImplicitFlow(Boolean oauth2AllowImplicitFlow) { + this.oauth2AllowImplicitFlow = oauth2AllowImplicitFlow; + return this; + } + + /** + * Get specifies resources that this application requires access to and the set of OAuth permission scopes and application roles that it needs under each of those resources. This pre-configuration of required resource access drives the consent experience. + * + * @return the requiredResourceAccess value + */ + public List requiredResourceAccess() { + return this.requiredResourceAccess; + } + + /** + * Set specifies resources that this application requires access to and the set of OAuth permission scopes and application roles that it needs under each of those resources. This pre-configuration of required resource access drives the consent experience. + * + * @param requiredResourceAccess the requiredResourceAccess value to set + * @return the ApplicationCreateParameters object itself. + */ + public ApplicationCreateParameters withRequiredResourceAccess(List requiredResourceAccess) { + this.requiredResourceAccess = requiredResourceAccess; + return this; + } + +} diff --git a/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/ApplicationUpdateParameters.java b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/ApplicationUpdateParameters.java new file mode 100644 index 000000000000..5661e937114c --- /dev/null +++ b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/ApplicationUpdateParameters.java @@ -0,0 +1,284 @@ +/** + * 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; + +import java.util.Map; +import java.util.List; +import com.microsoft.azure.graphrbac.implementation.KeyCredentialInner; +import com.microsoft.azure.graphrbac.implementation.PasswordCredentialInner; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Request parameters for updating an existing application. + */ +public class ApplicationUpdateParameters { + /** + * Unmatched properties from the message are deserialized this collection. + */ + @JsonProperty(value = "") + private Map additionalProperties; + + /** + * Whether the application is available to other tenants. + */ + @JsonProperty(value = "availableToOtherTenants") + private Boolean availableToOtherTenants; + + /** + * The display name of the application. + */ + @JsonProperty(value = "displayName") + private String displayName; + + /** + * The home page of the application. + */ + @JsonProperty(value = "homepage") + private String homepage; + + /** + * A collection of URIs for the application. + */ + @JsonProperty(value = "identifierUris") + private List identifierUris; + + /** + * A collection of reply URLs for the application. + */ + @JsonProperty(value = "replyUrls") + private List replyUrls; + + /** + * The list of KeyCredential objects. + */ + @JsonProperty(value = "keyCredentials") + private List keyCredentials; + + /** + * The list of PasswordCredential objects. + */ + @JsonProperty(value = "passwordCredentials") + private List passwordCredentials; + + /** + * Whether to allow implicit grant flow for OAuth2. + */ + @JsonProperty(value = "oauth2AllowImplicitFlow") + private Boolean oauth2AllowImplicitFlow; + + /** + * Specifies resources that this application requires access to and the set + * of OAuth permission scopes and application roles that it needs under + * each of those resources. This pre-configuration of required resource + * access drives the consent experience. + */ + @JsonProperty(value = "requiredResourceAccess") + private List requiredResourceAccess; + + /** + * Get unmatched properties from the message are deserialized this collection. + * + * @return the additionalProperties value + */ + public Map additionalProperties() { + return this.additionalProperties; + } + + /** + * Set unmatched properties from the message are deserialized this collection. + * + * @param additionalProperties the additionalProperties value to set + * @return the ApplicationUpdateParameters object itself. + */ + public ApplicationUpdateParameters withAdditionalProperties(Map additionalProperties) { + this.additionalProperties = additionalProperties; + return this; + } + + /** + * Get whether the application is available to other tenants. + * + * @return the availableToOtherTenants value + */ + public Boolean availableToOtherTenants() { + return this.availableToOtherTenants; + } + + /** + * Set whether the application is available to other tenants. + * + * @param availableToOtherTenants the availableToOtherTenants value to set + * @return the ApplicationUpdateParameters object itself. + */ + public ApplicationUpdateParameters withAvailableToOtherTenants(Boolean availableToOtherTenants) { + this.availableToOtherTenants = availableToOtherTenants; + return this; + } + + /** + * Get the display name of the application. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the display name of the application. + * + * @param displayName the displayName value to set + * @return the ApplicationUpdateParameters object itself. + */ + public ApplicationUpdateParameters withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the home page of the application. + * + * @return the homepage value + */ + public String homepage() { + return this.homepage; + } + + /** + * Set the home page of the application. + * + * @param homepage the homepage value to set + * @return the ApplicationUpdateParameters object itself. + */ + public ApplicationUpdateParameters withHomepage(String homepage) { + this.homepage = homepage; + return this; + } + + /** + * Get a collection of URIs for the application. + * + * @return the identifierUris value + */ + public List identifierUris() { + return this.identifierUris; + } + + /** + * Set a collection of URIs for the application. + * + * @param identifierUris the identifierUris value to set + * @return the ApplicationUpdateParameters object itself. + */ + public ApplicationUpdateParameters withIdentifierUris(List identifierUris) { + this.identifierUris = identifierUris; + return this; + } + + /** + * Get a collection of reply URLs for the application. + * + * @return the replyUrls value + */ + public List replyUrls() { + return this.replyUrls; + } + + /** + * Set a collection of reply URLs for the application. + * + * @param replyUrls the replyUrls value to set + * @return the ApplicationUpdateParameters object itself. + */ + public ApplicationUpdateParameters withReplyUrls(List replyUrls) { + this.replyUrls = replyUrls; + return this; + } + + /** + * Get the list of KeyCredential objects. + * + * @return the keyCredentials value + */ + public List keyCredentials() { + return this.keyCredentials; + } + + /** + * Set the list of KeyCredential objects. + * + * @param keyCredentials the keyCredentials value to set + * @return the ApplicationUpdateParameters object itself. + */ + public ApplicationUpdateParameters withKeyCredentials(List keyCredentials) { + this.keyCredentials = keyCredentials; + return this; + } + + /** + * Get the list of PasswordCredential objects. + * + * @return the passwordCredentials value + */ + public List passwordCredentials() { + return this.passwordCredentials; + } + + /** + * Set the list of PasswordCredential objects. + * + * @param passwordCredentials the passwordCredentials value to set + * @return the ApplicationUpdateParameters object itself. + */ + public ApplicationUpdateParameters withPasswordCredentials(List passwordCredentials) { + this.passwordCredentials = passwordCredentials; + return this; + } + + /** + * Get whether to allow implicit grant flow for OAuth2. + * + * @return the oauth2AllowImplicitFlow value + */ + public Boolean oauth2AllowImplicitFlow() { + return this.oauth2AllowImplicitFlow; + } + + /** + * Set whether to allow implicit grant flow for OAuth2. + * + * @param oauth2AllowImplicitFlow the oauth2AllowImplicitFlow value to set + * @return the ApplicationUpdateParameters object itself. + */ + public ApplicationUpdateParameters withOauth2AllowImplicitFlow(Boolean oauth2AllowImplicitFlow) { + this.oauth2AllowImplicitFlow = oauth2AllowImplicitFlow; + return this; + } + + /** + * Get specifies resources that this application requires access to and the set of OAuth permission scopes and application roles that it needs under each of those resources. This pre-configuration of required resource access drives the consent experience. + * + * @return the requiredResourceAccess value + */ + public List requiredResourceAccess() { + return this.requiredResourceAccess; + } + + /** + * Set specifies resources that this application requires access to and the set of OAuth permission scopes and application roles that it needs under each of those resources. This pre-configuration of required resource access drives the consent experience. + * + * @param requiredResourceAccess the requiredResourceAccess value to set + * @return the ApplicationUpdateParameters object itself. + */ + public ApplicationUpdateParameters withRequiredResourceAccess(List requiredResourceAccess) { + this.requiredResourceAccess = requiredResourceAccess; + return this; + } + +} diff --git a/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/CheckGroupMembershipParameters.java b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/CheckGroupMembershipParameters.java new file mode 100644 index 000000000000..c766c9500a6d --- /dev/null +++ b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/CheckGroupMembershipParameters.java @@ -0,0 +1,97 @@ +/** + * 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; + +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Request parameters for IsMemberOf API call. + */ +public class CheckGroupMembershipParameters { + /** + * Unmatched properties from the message are deserialized this collection. + */ + @JsonProperty(value = "") + private Map additionalProperties; + + /** + * The object ID of the group to check. + */ + @JsonProperty(value = "groupId", required = true) + private String groupId; + + /** + * The object ID of the contact, group, user, or service principal to check + * for membership in the specified group. + */ + @JsonProperty(value = "memberId", required = true) + private String memberId; + + /** + * Get unmatched properties from the message are deserialized this collection. + * + * @return the additionalProperties value + */ + public Map additionalProperties() { + return this.additionalProperties; + } + + /** + * Set unmatched properties from the message are deserialized this collection. + * + * @param additionalProperties the additionalProperties value to set + * @return the CheckGroupMembershipParameters object itself. + */ + public CheckGroupMembershipParameters withAdditionalProperties(Map additionalProperties) { + this.additionalProperties = additionalProperties; + return this; + } + + /** + * Get the object ID of the group to check. + * + * @return the groupId value + */ + public String groupId() { + return this.groupId; + } + + /** + * Set the object ID of the group to check. + * + * @param groupId the groupId value to set + * @return the CheckGroupMembershipParameters object itself. + */ + public CheckGroupMembershipParameters withGroupId(String groupId) { + this.groupId = groupId; + return this; + } + + /** + * Get the object ID of the contact, group, user, or service principal to check for membership in the specified group. + * + * @return the memberId value + */ + public String memberId() { + return this.memberId; + } + + /** + * Set the object ID of the contact, group, user, or service principal to check for membership in the specified group. + * + * @param memberId the memberId value to set + * @return the CheckGroupMembershipParameters object itself. + */ + public CheckGroupMembershipParameters withMemberId(String memberId) { + this.memberId = memberId; + return this; + } + +} diff --git a/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/GetObjectsParameters.java b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/GetObjectsParameters.java new file mode 100644 index 000000000000..013fbbf3bcbd --- /dev/null +++ b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/GetObjectsParameters.java @@ -0,0 +1,123 @@ +/** + * 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; + +import java.util.Map; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Request parameters for the GetObjectsByObjectIds API. + */ +public class GetObjectsParameters { + /** + * Unmatched properties from the message are deserialized this collection. + */ + @JsonProperty(value = "") + private Map additionalProperties; + + /** + * The requested object IDs. + */ + @JsonProperty(value = "objectIds") + private List objectIds; + + /** + * The requested object types. + */ + @JsonProperty(value = "types") + private List types; + + /** + * If true, also searches for object IDs in the partner tenant. + */ + @JsonProperty(value = "includeDirectoryObjectReferences", required = true) + private boolean includeDirectoryObjectReferences; + + /** + * Get unmatched properties from the message are deserialized this collection. + * + * @return the additionalProperties value + */ + public Map additionalProperties() { + return this.additionalProperties; + } + + /** + * Set unmatched properties from the message are deserialized this collection. + * + * @param additionalProperties the additionalProperties value to set + * @return the GetObjectsParameters object itself. + */ + public GetObjectsParameters withAdditionalProperties(Map additionalProperties) { + this.additionalProperties = additionalProperties; + return this; + } + + /** + * Get the requested object IDs. + * + * @return the objectIds value + */ + public List objectIds() { + return this.objectIds; + } + + /** + * Set the requested object IDs. + * + * @param objectIds the objectIds value to set + * @return the GetObjectsParameters object itself. + */ + public GetObjectsParameters withObjectIds(List objectIds) { + this.objectIds = objectIds; + return this; + } + + /** + * Get the requested object types. + * + * @return the types value + */ + public List types() { + return this.types; + } + + /** + * Set the requested object types. + * + * @param types the types value to set + * @return the GetObjectsParameters object itself. + */ + public GetObjectsParameters withTypes(List types) { + this.types = types; + return this; + } + + /** + * Get if true, also searches for object IDs in the partner tenant. + * + * @return the includeDirectoryObjectReferences value + */ + public boolean includeDirectoryObjectReferences() { + return this.includeDirectoryObjectReferences; + } + + /** + * Set if true, also searches for object IDs in the partner tenant. + * + * @param includeDirectoryObjectReferences the includeDirectoryObjectReferences value to set + * @return the GetObjectsParameters object itself. + */ + public GetObjectsParameters withIncludeDirectoryObjectReferences(boolean includeDirectoryObjectReferences) { + this.includeDirectoryObjectReferences = includeDirectoryObjectReferences; + return this; + } + +} diff --git a/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/GraphError.java b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/GraphError.java new file mode 100644 index 000000000000..2ee0ee9bedb2 --- /dev/null +++ b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/GraphError.java @@ -0,0 +1,71 @@ +/** + * 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; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * Active Directory error information. + */ +@JsonFlatten +public class GraphError { + /** + * Error code. + */ + @JsonProperty(value = "odata\\.error.code") + private String code; + + /** + * Error message value. + */ + @JsonProperty(value = "odata\\.error.message.value") + 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 GraphError object itself. + */ + public GraphError withCode(String code) { + this.code = code; + return this; + } + + /** + * Get error message value. + * + * @return the message value + */ + public String message() { + return this.message; + } + + /** + * Set error message value. + * + * @param message the message value to set + * @return the GraphError object itself. + */ + public GraphError withMessage(String message) { + this.message = message; + return this; + } + +} diff --git a/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/GraphErrorException.java b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/GraphErrorException.java new file mode 100644 index 000000000000..41d0bc870597 --- /dev/null +++ b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/GraphErrorException.java @@ -0,0 +1,44 @@ +/** + * 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; + +import com.microsoft.rest.RestException; +import okhttp3.ResponseBody; +import retrofit2.Response; + +/** + * Exception thrown for an invalid response with GraphError information. + */ +public class GraphErrorException extends RestException { + /** + * Initializes a new instance of the GraphErrorException class. + * + * @param message the exception message or the response content if a message is not available + * @param response the HTTP response + */ + public GraphErrorException(final String message, final Response response) { + super(message, response); + } + + /** + * Initializes a new instance of the GraphErrorException class. + * + * @param message the exception message or the response content if a message is not available + * @param response the HTTP response + * @param body the deserialized response body + */ + public GraphErrorException(final String message, final Response response, final GraphError body) { + super(message, response, body); + } + + @Override + public GraphError body() { + return (GraphError) super.body(); + } +} diff --git a/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/GroupAddMemberParameters.java b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/GroupAddMemberParameters.java new file mode 100644 index 000000000000..fbc9a0f87624 --- /dev/null +++ b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/GroupAddMemberParameters.java @@ -0,0 +1,74 @@ +/** + * 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; + +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Request parameters for adding a member to a group. + */ +public class GroupAddMemberParameters { + /** + * Unmatched properties from the message are deserialized this collection. + */ + @JsonProperty(value = "") + private Map additionalProperties; + + /** + * A member object URL, such as + * "https://graph.windows.net/0b1f9851-1bf0-433f-aec3-cb9272f093dc/directoryObjects/f260bbc4-c254-447b-94cf-293b5ec434dd", + * where "0b1f9851-1bf0-433f-aec3-cb9272f093dc" is the tenantId and + * "f260bbc4-c254-447b-94cf-293b5ec434dd" is the objectId of the member + * (user, application, servicePrincipal, group) to be added. + */ + @JsonProperty(value = "url", required = true) + private String url; + + /** + * Get unmatched properties from the message are deserialized this collection. + * + * @return the additionalProperties value + */ + public Map additionalProperties() { + return this.additionalProperties; + } + + /** + * Set unmatched properties from the message are deserialized this collection. + * + * @param additionalProperties the additionalProperties value to set + * @return the GroupAddMemberParameters object itself. + */ + public GroupAddMemberParameters withAdditionalProperties(Map additionalProperties) { + this.additionalProperties = additionalProperties; + return this; + } + + /** + * Get a member object URL, such as "https://graph.windows.net/0b1f9851-1bf0-433f-aec3-cb9272f093dc/directoryObjects/f260bbc4-c254-447b-94cf-293b5ec434dd", where "0b1f9851-1bf0-433f-aec3-cb9272f093dc" is the tenantId and "f260bbc4-c254-447b-94cf-293b5ec434dd" is the objectId of the member (user, application, servicePrincipal, group) to be added. + * + * @return the url value + */ + public String url() { + return this.url; + } + + /** + * Set a member object URL, such as "https://graph.windows.net/0b1f9851-1bf0-433f-aec3-cb9272f093dc/directoryObjects/f260bbc4-c254-447b-94cf-293b5ec434dd", where "0b1f9851-1bf0-433f-aec3-cb9272f093dc" is the tenantId and "f260bbc4-c254-447b-94cf-293b5ec434dd" is the objectId of the member (user, application, servicePrincipal, group) to be added. + * + * @param url the url value to set + * @return the GroupAddMemberParameters object itself. + */ + public GroupAddMemberParameters withUrl(String url) { + this.url = url; + return this; + } + +} diff --git a/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/GroupCreateParameters.java b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/GroupCreateParameters.java new file mode 100644 index 000000000000..6cac3b64b271 --- /dev/null +++ b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/GroupCreateParameters.java @@ -0,0 +1,160 @@ +/** + * 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; + +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Request parameters for creating a new group. + */ +public class GroupCreateParameters { + /** + * Unmatched properties from the message are deserialized this collection. + */ + @JsonProperty(value = "") + private Map additionalProperties; + + /** + * Group display name. + */ + @JsonProperty(value = "displayName", required = true) + private String displayName; + + /** + * Whether the group is mail-enabled. Must be false. This is because only + * pure security groups can be created using the Graph API. + */ + @JsonProperty(value = "mailEnabled", required = true) + private boolean mailEnabled; + + /** + * Mail nickname. + */ + @JsonProperty(value = "mailNickname", required = true) + private String mailNickname; + + /** + * Whether the group is a security group. Must be true. This is because + * only pure security groups can be created using the Graph API. + */ + @JsonProperty(value = "securityEnabled", required = true) + private boolean securityEnabled; + + /** + * Creates an instance of GroupCreateParameters class. + * @param displayName group display name. + * @param mailNickname mail nickname. + */ + public GroupCreateParameters() { + mailEnabled = false; + securityEnabled = true; + } + + /** + * Get unmatched properties from the message are deserialized this collection. + * + * @return the additionalProperties value + */ + public Map additionalProperties() { + return this.additionalProperties; + } + + /** + * Set unmatched properties from the message are deserialized this collection. + * + * @param additionalProperties the additionalProperties value to set + * @return the GroupCreateParameters object itself. + */ + public GroupCreateParameters withAdditionalProperties(Map additionalProperties) { + this.additionalProperties = additionalProperties; + return this; + } + + /** + * Get group display name. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Set group display name. + * + * @param displayName the displayName value to set + * @return the GroupCreateParameters object itself. + */ + public GroupCreateParameters withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get whether the group is mail-enabled. Must be false. This is because only pure security groups can be created using the Graph API. + * + * @return the mailEnabled value + */ + public boolean mailEnabled() { + return this.mailEnabled; + } + + /** + * Set whether the group is mail-enabled. Must be false. This is because only pure security groups can be created using the Graph API. + * + * @param mailEnabled the mailEnabled value to set + * @return the GroupCreateParameters object itself. + */ + public GroupCreateParameters withMailEnabled(boolean mailEnabled) { + this.mailEnabled = mailEnabled; + return this; + } + + /** + * Get mail nickname. + * + * @return the mailNickname value + */ + public String mailNickname() { + return this.mailNickname; + } + + /** + * Set mail nickname. + * + * @param mailNickname the mailNickname value to set + * @return the GroupCreateParameters object itself. + */ + public GroupCreateParameters withMailNickname(String mailNickname) { + this.mailNickname = mailNickname; + return this; + } + + /** + * Get whether the group is a security group. Must be true. This is because only pure security groups can be created using the Graph API. + * + * @return the securityEnabled value + */ + public boolean securityEnabled() { + return this.securityEnabled; + } + + /** + * Set whether the group is a security group. Must be true. This is because only pure security groups can be created using the Graph API. + * + * @param securityEnabled the securityEnabled value to set + * @return the GroupCreateParameters object itself. + */ + public GroupCreateParameters withSecurityEnabled(boolean securityEnabled) { + this.securityEnabled = securityEnabled; + return this; + } + +} diff --git a/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/GroupGetMemberGroupsParameters.java b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/GroupGetMemberGroupsParameters.java new file mode 100644 index 000000000000..c989da87507c --- /dev/null +++ b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/GroupGetMemberGroupsParameters.java @@ -0,0 +1,71 @@ +/** + * 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; + +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Request parameters for GetMemberGroups API call. + */ +public class GroupGetMemberGroupsParameters { + /** + * Unmatched properties from the message are deserialized this collection. + */ + @JsonProperty(value = "") + private Map additionalProperties; + + /** + * If true, only membership in security-enabled groups should be checked. + * Otherwise, membership in all groups should be checked. + */ + @JsonProperty(value = "securityEnabledOnly", required = true) + private boolean securityEnabledOnly; + + /** + * Get unmatched properties from the message are deserialized this collection. + * + * @return the additionalProperties value + */ + public Map additionalProperties() { + return this.additionalProperties; + } + + /** + * Set unmatched properties from the message are deserialized this collection. + * + * @param additionalProperties the additionalProperties value to set + * @return the GroupGetMemberGroupsParameters object itself. + */ + public GroupGetMemberGroupsParameters withAdditionalProperties(Map additionalProperties) { + this.additionalProperties = additionalProperties; + return this; + } + + /** + * Get if true, only membership in security-enabled groups should be checked. Otherwise, membership in all groups should be checked. + * + * @return the securityEnabledOnly value + */ + public boolean securityEnabledOnly() { + return this.securityEnabledOnly; + } + + /** + * Set if true, only membership in security-enabled groups should be checked. Otherwise, membership in all groups should be checked. + * + * @param securityEnabledOnly the securityEnabledOnly value to set + * @return the GroupGetMemberGroupsParameters object itself. + */ + public GroupGetMemberGroupsParameters withSecurityEnabledOnly(boolean securityEnabledOnly) { + this.securityEnabledOnly = securityEnabledOnly; + return this; + } + +} diff --git a/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/KeyCredentialsUpdateParameters.java b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/KeyCredentialsUpdateParameters.java new file mode 100644 index 000000000000..6df738b34e54 --- /dev/null +++ b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/KeyCredentialsUpdateParameters.java @@ -0,0 +1,45 @@ +/** + * 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; + +import java.util.List; +import com.microsoft.azure.graphrbac.implementation.KeyCredentialInner; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Request parameters for a KeyCredentials update operation. + */ +public class KeyCredentialsUpdateParameters { + /** + * A collection of KeyCredentials. + */ + @JsonProperty(value = "value", required = true) + private List value; + + /** + * Get a collection of KeyCredentials. + * + * @return the value value + */ + public List value() { + return this.value; + } + + /** + * Set a collection of KeyCredentials. + * + * @param value the value value to set + * @return the KeyCredentialsUpdateParameters object itself. + */ + public KeyCredentialsUpdateParameters withValue(List value) { + this.value = value; + return this; + } + +} diff --git a/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/PasswordCredentialsUpdateParameters.java b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/PasswordCredentialsUpdateParameters.java new file mode 100644 index 000000000000..fa6eba69d266 --- /dev/null +++ b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/PasswordCredentialsUpdateParameters.java @@ -0,0 +1,45 @@ +/** + * 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; + +import java.util.List; +import com.microsoft.azure.graphrbac.implementation.PasswordCredentialInner; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Request parameters for a PasswordCredentials update operation. + */ +public class PasswordCredentialsUpdateParameters { + /** + * A collection of PasswordCredentials. + */ + @JsonProperty(value = "value", required = true) + private List value; + + /** + * Get a collection of PasswordCredentials. + * + * @return the value value + */ + public List value() { + return this.value; + } + + /** + * Set a collection of PasswordCredentials. + * + * @param value the value value to set + * @return the PasswordCredentialsUpdateParameters object itself. + */ + public PasswordCredentialsUpdateParameters withValue(List value) { + this.value = value; + return this; + } + +} diff --git a/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/PasswordProfile.java b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/PasswordProfile.java new file mode 100644 index 000000000000..73f2e65b0c10 --- /dev/null +++ b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/PasswordProfile.java @@ -0,0 +1,96 @@ +/** + * 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; + +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The password profile associated with a user. + */ +public class PasswordProfile { + /** + * Unmatched properties from the message are deserialized this collection. + */ + @JsonProperty(value = "") + private Map additionalProperties; + + /** + * Password. + */ + @JsonProperty(value = "password", required = true) + private String password; + + /** + * Whether to force a password change on next login. + */ + @JsonProperty(value = "forceChangePasswordNextLogin") + private Boolean forceChangePasswordNextLogin; + + /** + * Get unmatched properties from the message are deserialized this collection. + * + * @return the additionalProperties value + */ + public Map additionalProperties() { + return this.additionalProperties; + } + + /** + * Set unmatched properties from the message are deserialized this collection. + * + * @param additionalProperties the additionalProperties value to set + * @return the PasswordProfile object itself. + */ + public PasswordProfile withAdditionalProperties(Map additionalProperties) { + this.additionalProperties = additionalProperties; + return this; + } + + /** + * Get password. + * + * @return the password value + */ + public String password() { + return this.password; + } + + /** + * Set password. + * + * @param password the password value to set + * @return the PasswordProfile object itself. + */ + public PasswordProfile withPassword(String password) { + this.password = password; + return this; + } + + /** + * Get whether to force a password change on next login. + * + * @return the forceChangePasswordNextLogin value + */ + public Boolean forceChangePasswordNextLogin() { + return this.forceChangePasswordNextLogin; + } + + /** + * Set whether to force a password change on next login. + * + * @param forceChangePasswordNextLogin the forceChangePasswordNextLogin value to set + * @return the PasswordProfile object itself. + */ + public PasswordProfile withForceChangePasswordNextLogin(Boolean forceChangePasswordNextLogin) { + this.forceChangePasswordNextLogin = forceChangePasswordNextLogin; + return this; + } + +} diff --git a/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/RequiredResourceAccess.java b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/RequiredResourceAccess.java new file mode 100644 index 000000000000..e8c52d43ed8b --- /dev/null +++ b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/RequiredResourceAccess.java @@ -0,0 +1,105 @@ +/** + * 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; + +import java.util.Map; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Specifies the set of OAuth 2.0 permission scopes and app roles under the + * specified resource that an application requires access to. The specified + * OAuth 2.0 permission scopes may be requested by client applications (through + * the requiredResourceAccess collection) when calling a resource application. + * The requiredResourceAccess property of the Application entity is a + * collection of ReqiredResourceAccess. + */ +public class RequiredResourceAccess { + /** + * Unmatched properties from the message are deserialized this collection. + */ + @JsonProperty(value = "") + private Map additionalProperties; + + /** + * The list of OAuth2.0 permission scopes and app roles that the + * application requires from the specified resource. + */ + @JsonProperty(value = "resourceAccess", required = true) + private List resourceAccess; + + /** + * The unique identifier for the resource that the application requires + * access to. This should be equal to the appId declared on the target + * resource application. + */ + @JsonProperty(value = "resourceAppId") + private String resourceAppId; + + /** + * Get unmatched properties from the message are deserialized this collection. + * + * @return the additionalProperties value + */ + public Map additionalProperties() { + return this.additionalProperties; + } + + /** + * Set unmatched properties from the message are deserialized this collection. + * + * @param additionalProperties the additionalProperties value to set + * @return the RequiredResourceAccess object itself. + */ + public RequiredResourceAccess withAdditionalProperties(Map additionalProperties) { + this.additionalProperties = additionalProperties; + return this; + } + + /** + * Get the list of OAuth2.0 permission scopes and app roles that the application requires from the specified resource. + * + * @return the resourceAccess value + */ + public List resourceAccess() { + return this.resourceAccess; + } + + /** + * Set the list of OAuth2.0 permission scopes and app roles that the application requires from the specified resource. + * + * @param resourceAccess the resourceAccess value to set + * @return the RequiredResourceAccess object itself. + */ + public RequiredResourceAccess withResourceAccess(List resourceAccess) { + this.resourceAccess = resourceAccess; + return this; + } + + /** + * Get the unique identifier for the resource that the application requires access to. This should be equal to the appId declared on the target resource application. + * + * @return the resourceAppId value + */ + public String resourceAppId() { + return this.resourceAppId; + } + + /** + * Set the unique identifier for the resource that the application requires access to. This should be equal to the appId declared on the target resource application. + * + * @param resourceAppId the resourceAppId value to set + * @return the RequiredResourceAccess object itself. + */ + public RequiredResourceAccess withResourceAppId(String resourceAppId) { + this.resourceAppId = resourceAppId; + return this; + } + +} diff --git a/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/ResourceAccess.java b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/ResourceAccess.java new file mode 100644 index 000000000000..caab61c5060e --- /dev/null +++ b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/ResourceAccess.java @@ -0,0 +1,100 @@ +/** + * 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; + +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Specifies an OAuth 2.0 permission scope or an app role that an application + * requires. The resourceAccess property of the RequiredResourceAccess type is + * a collection of ResourceAccess. + */ +public class ResourceAccess { + /** + * Unmatched properties from the message are deserialized this collection. + */ + @JsonProperty(value = "") + private Map additionalProperties; + + /** + * The unique identifier for one of the OAuth2Permission or AppRole + * instances that the resource application exposes. + */ + @JsonProperty(value = "id", required = true) + private String id; + + /** + * Specifies whether the id property references an OAuth2Permission or an + * AppRole. Possible values are "scope" or "role". + */ + @JsonProperty(value = "type") + private String type; + + /** + * Get unmatched properties from the message are deserialized this collection. + * + * @return the additionalProperties value + */ + public Map additionalProperties() { + return this.additionalProperties; + } + + /** + * Set unmatched properties from the message are deserialized this collection. + * + * @param additionalProperties the additionalProperties value to set + * @return the ResourceAccess object itself. + */ + public ResourceAccess withAdditionalProperties(Map additionalProperties) { + this.additionalProperties = additionalProperties; + return this; + } + + /** + * Get the unique identifier for one of the OAuth2Permission or AppRole instances that the resource application exposes. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Set the unique identifier for one of the OAuth2Permission or AppRole instances that the resource application exposes. + * + * @param id the id value to set + * @return the ResourceAccess object itself. + */ + public ResourceAccess withId(String id) { + this.id = id; + return this; + } + + /** + * Get specifies whether the id property references an OAuth2Permission or an AppRole. Possible values are "scope" or "role". + * + * @return the type value + */ + public String type() { + return this.type; + } + + /** + * Set specifies whether the id property references an OAuth2Permission or an AppRole. Possible values are "scope" or "role". + * + * @param type the type value to set + * @return the ResourceAccess object itself. + */ + public ResourceAccess withType(String type) { + this.type = type; + return this; + } + +} diff --git a/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/ServicePrincipalCreateParameters.java b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/ServicePrincipalCreateParameters.java new file mode 100644 index 000000000000..37c2e2f4fe6b --- /dev/null +++ b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/ServicePrincipalCreateParameters.java @@ -0,0 +1,151 @@ +/** + * 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; + +import java.util.Map; +import java.util.List; +import com.microsoft.azure.graphrbac.implementation.KeyCredentialInner; +import com.microsoft.azure.graphrbac.implementation.PasswordCredentialInner; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Request parameters for creating a new service principal. + */ +public class ServicePrincipalCreateParameters { + /** + * Unmatched properties from the message are deserialized this collection. + */ + @JsonProperty(value = "") + private Map additionalProperties; + + /** + * application Id. + */ + @JsonProperty(value = "appId", required = true) + private String appId; + + /** + * Whether the account is enabled. + */ + @JsonProperty(value = "accountEnabled", required = true) + private boolean accountEnabled; + + /** + * A collection of KeyCredential objects. + */ + @JsonProperty(value = "keyCredentials") + private List keyCredentials; + + /** + * A collection of PasswordCredential objects. + */ + @JsonProperty(value = "passwordCredentials") + private List passwordCredentials; + + /** + * Get unmatched properties from the message are deserialized this collection. + * + * @return the additionalProperties value + */ + public Map additionalProperties() { + return this.additionalProperties; + } + + /** + * Set unmatched properties from the message are deserialized this collection. + * + * @param additionalProperties the additionalProperties value to set + * @return the ServicePrincipalCreateParameters object itself. + */ + public ServicePrincipalCreateParameters withAdditionalProperties(Map additionalProperties) { + this.additionalProperties = additionalProperties; + return this; + } + + /** + * Get application Id. + * + * @return the appId value + */ + public String appId() { + return this.appId; + } + + /** + * Set application Id. + * + * @param appId the appId value to set + * @return the ServicePrincipalCreateParameters object itself. + */ + public ServicePrincipalCreateParameters withAppId(String appId) { + this.appId = appId; + return this; + } + + /** + * Get whether the account is enabled. + * + * @return the accountEnabled value + */ + public boolean accountEnabled() { + return this.accountEnabled; + } + + /** + * Set whether the account is enabled. + * + * @param accountEnabled the accountEnabled value to set + * @return the ServicePrincipalCreateParameters object itself. + */ + public ServicePrincipalCreateParameters withAccountEnabled(boolean accountEnabled) { + this.accountEnabled = accountEnabled; + return this; + } + + /** + * Get a collection of KeyCredential objects. + * + * @return the keyCredentials value + */ + public List keyCredentials() { + return this.keyCredentials; + } + + /** + * Set a collection of KeyCredential objects. + * + * @param keyCredentials the keyCredentials value to set + * @return the ServicePrincipalCreateParameters object itself. + */ + public ServicePrincipalCreateParameters withKeyCredentials(List keyCredentials) { + this.keyCredentials = keyCredentials; + return this; + } + + /** + * Get a collection of PasswordCredential objects. + * + * @return the passwordCredentials value + */ + public List passwordCredentials() { + return this.passwordCredentials; + } + + /** + * Set a collection of PasswordCredential objects. + * + * @param passwordCredentials the passwordCredentials value to set + * @return the ServicePrincipalCreateParameters object itself. + */ + public ServicePrincipalCreateParameters withPasswordCredentials(List passwordCredentials) { + this.passwordCredentials = passwordCredentials; + return this; + } + +} diff --git a/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/SignInName.java b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/SignInName.java new file mode 100644 index 000000000000..7d05c60f2654 --- /dev/null +++ b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/SignInName.java @@ -0,0 +1,99 @@ +/** + * 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; + +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Contains information about a sign-in name of a local account user in an + * Azure Active Directory B2C tenant. + */ +public class SignInName { + /** + * Unmatched properties from the message are deserialized this collection. + */ + @JsonProperty(value = "") + private Map additionalProperties; + + /** + * A string value that can be used to classify user sign-in types in your + * directory, such as 'emailAddress' or 'userName'. + */ + @JsonProperty(value = "type") + private String type; + + /** + * The sign-in used by the local account. Must be unique across the + * company/tenant. For example, 'johnc@example.com'. + */ + @JsonProperty(value = "value") + private String value; + + /** + * Get unmatched properties from the message are deserialized this collection. + * + * @return the additionalProperties value + */ + public Map additionalProperties() { + return this.additionalProperties; + } + + /** + * Set unmatched properties from the message are deserialized this collection. + * + * @param additionalProperties the additionalProperties value to set + * @return the SignInName object itself. + */ + public SignInName withAdditionalProperties(Map additionalProperties) { + this.additionalProperties = additionalProperties; + return this; + } + + /** + * Get a string value that can be used to classify user sign-in types in your directory, such as 'emailAddress' or 'userName'. + * + * @return the type value + */ + public String type() { + return this.type; + } + + /** + * Set a string value that can be used to classify user sign-in types in your directory, such as 'emailAddress' or 'userName'. + * + * @param type the type value to set + * @return the SignInName object itself. + */ + public SignInName withType(String type) { + this.type = type; + return this; + } + + /** + * Get the sign-in used by the local account. Must be unique across the company/tenant. For example, 'johnc@example.com'. + * + * @return the value value + */ + public String value() { + return this.value; + } + + /** + * Set the sign-in used by the local account. Must be unique across the company/tenant. For example, 'johnc@example.com'. + * + * @param value the value value to set + * @return the SignInName object itself. + */ + public SignInName withValue(String value) { + this.value = value; + return this; + } + +} diff --git a/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/UserBase.java b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/UserBase.java new file mode 100644 index 000000000000..edfd845bce04 --- /dev/null +++ b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/UserBase.java @@ -0,0 +1,182 @@ +/** + * 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; + +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The UserBase model. + */ +public class UserBase { + /** + * Unmatched properties from the message are deserialized this collection. + */ + @JsonProperty(value = "") + private Map additionalProperties; + + /** + * This must be specified if you are using a federated domain for the + * user's userPrincipalName (UPN) property when creating a new user + * account. It is used to associate an on-premises Active Directory user + * account with their Azure AD user object. + */ + @JsonProperty(value = "immutableId") + private String immutableId; + + /** + * A two letter country code (ISO standard 3166). Required for users that + * will be assigned licenses due to legal requirement to check for + * availability of services in countries. Examples include: "US", "JP", and + * "GB". + */ + @JsonProperty(value = "usageLocation") + private String usageLocation; + + /** + * The given name for the user. + */ + @JsonProperty(value = "givenName") + private String givenName; + + /** + * The user's surname (family name or last name). + */ + @JsonProperty(value = "surname") + private String surname; + + /** + * A string value that can be used to classify user types in your + * directory, such as 'Member' and 'Guest'. Possible values include: + * 'Member', 'Guest'. + */ + @JsonProperty(value = "userType") + private UserType userType; + + /** + * Get unmatched properties from the message are deserialized this collection. + * + * @return the additionalProperties value + */ + public Map additionalProperties() { + return this.additionalProperties; + } + + /** + * Set unmatched properties from the message are deserialized this collection. + * + * @param additionalProperties the additionalProperties value to set + * @return the UserBase object itself. + */ + public UserBase withAdditionalProperties(Map additionalProperties) { + this.additionalProperties = additionalProperties; + return this; + } + + /** + * Get this must be specified if you are using a federated domain for the user's userPrincipalName (UPN) property when creating a new user account. It is used to associate an on-premises Active Directory user account with their Azure AD user object. + * + * @return the immutableId value + */ + public String immutableId() { + return this.immutableId; + } + + /** + * Set this must be specified if you are using a federated domain for the user's userPrincipalName (UPN) property when creating a new user account. It is used to associate an on-premises Active Directory user account with their Azure AD user object. + * + * @param immutableId the immutableId value to set + * @return the UserBase object itself. + */ + public UserBase withImmutableId(String immutableId) { + this.immutableId = immutableId; + return this; + } + + /** + * Get a two letter country code (ISO standard 3166). Required for users that will be assigned licenses due to legal requirement to check for availability of services in countries. Examples include: "US", "JP", and "GB". + * + * @return the usageLocation value + */ + public String usageLocation() { + return this.usageLocation; + } + + /** + * Set a two letter country code (ISO standard 3166). Required for users that will be assigned licenses due to legal requirement to check for availability of services in countries. Examples include: "US", "JP", and "GB". + * + * @param usageLocation the usageLocation value to set + * @return the UserBase object itself. + */ + public UserBase withUsageLocation(String usageLocation) { + this.usageLocation = usageLocation; + return this; + } + + /** + * Get the given name for the user. + * + * @return the givenName value + */ + public String givenName() { + return this.givenName; + } + + /** + * Set the given name for the user. + * + * @param givenName the givenName value to set + * @return the UserBase object itself. + */ + public UserBase withGivenName(String givenName) { + this.givenName = givenName; + return this; + } + + /** + * Get the user's surname (family name or last name). + * + * @return the surname value + */ + public String surname() { + return this.surname; + } + + /** + * Set the user's surname (family name or last name). + * + * @param surname the surname value to set + * @return the UserBase object itself. + */ + public UserBase withSurname(String surname) { + this.surname = surname; + return this; + } + + /** + * Get a string value that can be used to classify user types in your directory, such as 'Member' and 'Guest'. Possible values include: 'Member', 'Guest'. + * + * @return the userType value + */ + public UserType userType() { + return this.userType; + } + + /** + * Set a string value that can be used to classify user types in your directory, such as 'Member' and 'Guest'. Possible values include: 'Member', 'Guest'. + * + * @param userType the userType value to set + * @return the UserBase object itself. + */ + public UserBase withUserType(UserType userType) { + this.userType = userType; + return this; + } + +} diff --git a/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/UserCreateParameters.java b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/UserCreateParameters.java new file mode 100644 index 000000000000..92a0d880fc8f --- /dev/null +++ b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/UserCreateParameters.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.graphrbac; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Request parameters for creating a new work or school account user. + */ +public class UserCreateParameters extends UserBase { + /** + * Whether the account is enabled. + */ + @JsonProperty(value = "accountEnabled", required = true) + private boolean accountEnabled; + + /** + * The display name of the user. + */ + @JsonProperty(value = "displayName", required = true) + private String displayName; + + /** + * Password Profile. + */ + @JsonProperty(value = "passwordProfile", required = true) + private PasswordProfile passwordProfile; + + /** + * The user principal name (someuser@contoso.com). It must contain one of + * the verified domains for the tenant. + */ + @JsonProperty(value = "userPrincipalName", required = true) + private String userPrincipalName; + + /** + * The mail alias for the user. + */ + @JsonProperty(value = "mailNickname", required = true) + private String mailNickname; + + /** + * The primary email address of the user. + */ + @JsonProperty(value = "mail") + private String mail; + + /** + * Get whether the account is enabled. + * + * @return the accountEnabled value + */ + public boolean accountEnabled() { + return this.accountEnabled; + } + + /** + * Set whether the account is enabled. + * + * @param accountEnabled the accountEnabled value to set + * @return the UserCreateParameters object itself. + */ + public UserCreateParameters withAccountEnabled(boolean accountEnabled) { + this.accountEnabled = accountEnabled; + return this; + } + + /** + * Get the display name of the user. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the display name of the user. + * + * @param displayName the displayName value to set + * @return the UserCreateParameters object itself. + */ + public UserCreateParameters withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get password Profile. + * + * @return the passwordProfile value + */ + public PasswordProfile passwordProfile() { + return this.passwordProfile; + } + + /** + * Set password Profile. + * + * @param passwordProfile the passwordProfile value to set + * @return the UserCreateParameters object itself. + */ + public UserCreateParameters withPasswordProfile(PasswordProfile passwordProfile) { + this.passwordProfile = passwordProfile; + return this; + } + + /** + * Get the user principal name (someuser@contoso.com). It must contain one of the verified domains for the tenant. + * + * @return the userPrincipalName value + */ + public String userPrincipalName() { + return this.userPrincipalName; + } + + /** + * Set the user principal name (someuser@contoso.com). It must contain one of the verified domains for the tenant. + * + * @param userPrincipalName the userPrincipalName value to set + * @return the UserCreateParameters object itself. + */ + public UserCreateParameters withUserPrincipalName(String userPrincipalName) { + this.userPrincipalName = userPrincipalName; + return this; + } + + /** + * Get the mail alias for the user. + * + * @return the mailNickname value + */ + public String mailNickname() { + return this.mailNickname; + } + + /** + * Set the mail alias for the user. + * + * @param mailNickname the mailNickname value to set + * @return the UserCreateParameters object itself. + */ + public UserCreateParameters withMailNickname(String mailNickname) { + this.mailNickname = mailNickname; + return this; + } + + /** + * Get the primary email address of the user. + * + * @return the mail value + */ + public String mail() { + return this.mail; + } + + /** + * Set the primary email address of the user. + * + * @param mail the mail value to set + * @return the UserCreateParameters object itself. + */ + public UserCreateParameters withMail(String mail) { + this.mail = mail; + return this; + } + +} diff --git a/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/UserGetMemberGroupsParameters.java b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/UserGetMemberGroupsParameters.java new file mode 100644 index 000000000000..6837a985e28f --- /dev/null +++ b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/UserGetMemberGroupsParameters.java @@ -0,0 +1,71 @@ +/** + * 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; + +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Request parameters for GetMemberGroups API call. + */ +public class UserGetMemberGroupsParameters { + /** + * Unmatched properties from the message are deserialized this collection. + */ + @JsonProperty(value = "") + private Map additionalProperties; + + /** + * If true, only membership in security-enabled groups should be checked. + * Otherwise, membership in all groups should be checked. + */ + @JsonProperty(value = "securityEnabledOnly", required = true) + private boolean securityEnabledOnly; + + /** + * Get unmatched properties from the message are deserialized this collection. + * + * @return the additionalProperties value + */ + public Map additionalProperties() { + return this.additionalProperties; + } + + /** + * Set unmatched properties from the message are deserialized this collection. + * + * @param additionalProperties the additionalProperties value to set + * @return the UserGetMemberGroupsParameters object itself. + */ + public UserGetMemberGroupsParameters withAdditionalProperties(Map additionalProperties) { + this.additionalProperties = additionalProperties; + return this; + } + + /** + * Get if true, only membership in security-enabled groups should be checked. Otherwise, membership in all groups should be checked. + * + * @return the securityEnabledOnly value + */ + public boolean securityEnabledOnly() { + return this.securityEnabledOnly; + } + + /** + * Set if true, only membership in security-enabled groups should be checked. Otherwise, membership in all groups should be checked. + * + * @param securityEnabledOnly the securityEnabledOnly value to set + * @return the UserGetMemberGroupsParameters object itself. + */ + public UserGetMemberGroupsParameters withSecurityEnabledOnly(boolean securityEnabledOnly) { + this.securityEnabledOnly = securityEnabledOnly; + return this; + } + +} diff --git a/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/UserType.java b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/UserType.java new file mode 100644 index 000000000000..ec52a55a8216 --- /dev/null +++ b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/UserType.java @@ -0,0 +1,41 @@ +/** + * 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; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for UserType. + */ +public final class UserType extends ExpandableStringEnum { + /** Static value Member for UserType. */ + public static final UserType MEMBER = fromString("Member"); + + /** Static value Guest for UserType. */ + public static final UserType GUEST = fromString("Guest"); + + /** + * Creates or finds a UserType from its string representation. + * @param name a name to look for + * @return the corresponding UserType + */ + @JsonCreator + public static UserType fromString(String name) { + return fromString(name, UserType.class); + } + + /** + * @return known UserType values + */ + public static Collection values() { + return values(UserType.class); + } +} diff --git a/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/UserUpdateParameters.java b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/UserUpdateParameters.java new file mode 100644 index 000000000000..da502bd599ab --- /dev/null +++ b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/UserUpdateParameters.java @@ -0,0 +1,148 @@ +/** + * 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; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Request parameters for updating an existing work or school account user. + */ +public class UserUpdateParameters extends UserBase { + /** + * Whether the account is enabled. + */ + @JsonProperty(value = "accountEnabled") + private Boolean accountEnabled; + + /** + * The display name of the user. + */ + @JsonProperty(value = "displayName") + private String displayName; + + /** + * The password profile of the user. + */ + @JsonProperty(value = "passwordProfile") + private PasswordProfile passwordProfile; + + /** + * The user principal name (someuser@contoso.com). It must contain one of + * the verified domains for the tenant. + */ + @JsonProperty(value = "userPrincipalName") + private String userPrincipalName; + + /** + * The mail alias for the user. + */ + @JsonProperty(value = "mailNickname") + private String mailNickname; + + /** + * Get whether the account is enabled. + * + * @return the accountEnabled value + */ + public Boolean accountEnabled() { + return this.accountEnabled; + } + + /** + * Set whether the account is enabled. + * + * @param accountEnabled the accountEnabled value to set + * @return the UserUpdateParameters object itself. + */ + public UserUpdateParameters withAccountEnabled(Boolean accountEnabled) { + this.accountEnabled = accountEnabled; + return this; + } + + /** + * Get the display name of the user. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the display name of the user. + * + * @param displayName the displayName value to set + * @return the UserUpdateParameters object itself. + */ + public UserUpdateParameters withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the password profile of the user. + * + * @return the passwordProfile value + */ + public PasswordProfile passwordProfile() { + return this.passwordProfile; + } + + /** + * Set the password profile of the user. + * + * @param passwordProfile the passwordProfile value to set + * @return the UserUpdateParameters object itself. + */ + public UserUpdateParameters withPasswordProfile(PasswordProfile passwordProfile) { + this.passwordProfile = passwordProfile; + return this; + } + + /** + * Get the user principal name (someuser@contoso.com). It must contain one of the verified domains for the tenant. + * + * @return the userPrincipalName value + */ + public String userPrincipalName() { + return this.userPrincipalName; + } + + /** + * Set the user principal name (someuser@contoso.com). It must contain one of the verified domains for the tenant. + * + * @param userPrincipalName the userPrincipalName value to set + * @return the UserUpdateParameters object itself. + */ + public UserUpdateParameters withUserPrincipalName(String userPrincipalName) { + this.userPrincipalName = userPrincipalName; + return this; + } + + /** + * Get the mail alias for the user. + * + * @return the mailNickname value + */ + public String mailNickname() { + return this.mailNickname; + } + + /** + * Set the mail alias for the user. + * + * @param mailNickname the mailNickname value to set + * @return the UserUpdateParameters object itself. + */ + public UserUpdateParameters withMailNickname(String mailNickname) { + this.mailNickname = mailNickname; + return this; + } + +} diff --git a/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/AADObjectInner.java b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/AADObjectInner.java new file mode 100644 index 000000000000..4c10dc088055 --- /dev/null +++ b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/AADObjectInner.java @@ -0,0 +1,428 @@ +/** + * 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 java.util.Map; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The properties of an Active Directory object. + */ +public class AADObjectInner { + /** + * Unmatched properties from the message are deserialized this collection. + */ + @JsonProperty(value = "") + private Map additionalProperties; + + /** + * The ID of the object. + */ + @JsonProperty(value = "objectId") + private String objectId; + + /** + * The type of AAD object. + */ + @JsonProperty(value = "objectType") + private String objectType; + + /** + * The display name of the object. + */ + @JsonProperty(value = "displayName") + private String displayName; + + /** + * The principal name of the object. + */ + @JsonProperty(value = "userPrincipalName") + private String userPrincipalName; + + /** + * The primary email address of the object. + */ + @JsonProperty(value = "mail") + private String mail; + + /** + * Whether the AAD object is mail-enabled. + */ + @JsonProperty(value = "mailEnabled") + private Boolean mailEnabled; + + /** + * The mail alias for the user. + */ + @JsonProperty(value = "mailNickname", access = JsonProperty.Access.WRITE_ONLY) + private String mailNickname; + + /** + * Whether the AAD object is security-enabled. + */ + @JsonProperty(value = "securityEnabled") + private Boolean securityEnabled; + + /** + * The sign-in name of the object. + */ + @JsonProperty(value = "signInName") + private String signInName; + + /** + * A collection of service principal names associated with the object. + */ + @JsonProperty(value = "servicePrincipalNames") + private List servicePrincipalNames; + + /** + * The user type of the object. + */ + @JsonProperty(value = "userType") + private String userType; + + /** + * A two letter country code (ISO standard 3166). Required for users that + * will be assigned licenses due to legal requirement to check for + * availability of services in countries. Examples include: "US", "JP", and + * "GB". + */ + @JsonProperty(value = "usageLocation", access = JsonProperty.Access.WRITE_ONLY) + private String usageLocation; + + /** + * The application ID. + */ + @JsonProperty(value = "appId", access = JsonProperty.Access.WRITE_ONLY) + private String appId; + + /** + * The application permissions. + */ + @JsonProperty(value = "appPermissions", access = JsonProperty.Access.WRITE_ONLY) + private List appPermissions; + + /** + * Whether the application is be available to other tenants. + */ + @JsonProperty(value = "availableToOtherTenants", access = JsonProperty.Access.WRITE_ONLY) + private Boolean availableToOtherTenants; + + /** + * A collection of URIs for the application. + */ + @JsonProperty(value = "identifierUris", access = JsonProperty.Access.WRITE_ONLY) + private List identifierUris; + + /** + * A collection of reply URLs for the application. + */ + @JsonProperty(value = "replyUrls", access = JsonProperty.Access.WRITE_ONLY) + private List replyUrls; + + /** + * The home page of the application. + */ + @JsonProperty(value = "homepage", access = JsonProperty.Access.WRITE_ONLY) + private String homepage; + + /** + * Get unmatched properties from the message are deserialized this collection. + * + * @return the additionalProperties value + */ + public Map additionalProperties() { + return this.additionalProperties; + } + + /** + * Set unmatched properties from the message are deserialized this collection. + * + * @param additionalProperties the additionalProperties value to set + * @return the AADObjectInner object itself. + */ + public AADObjectInner withAdditionalProperties(Map additionalProperties) { + this.additionalProperties = additionalProperties; + return this; + } + + /** + * Get the ID of the object. + * + * @return the objectId value + */ + public String objectId() { + return this.objectId; + } + + /** + * Set the ID of the object. + * + * @param objectId the objectId value to set + * @return the AADObjectInner object itself. + */ + public AADObjectInner withObjectId(String objectId) { + this.objectId = objectId; + return this; + } + + /** + * Get the type of AAD object. + * + * @return the objectType value + */ + public String objectType() { + return this.objectType; + } + + /** + * Set the type of AAD object. + * + * @param objectType the objectType value to set + * @return the AADObjectInner object itself. + */ + public AADObjectInner withObjectType(String objectType) { + this.objectType = objectType; + return this; + } + + /** + * Get the display name of the object. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the display name of the object. + * + * @param displayName the displayName value to set + * @return the AADObjectInner object itself. + */ + public AADObjectInner withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the principal name of the object. + * + * @return the userPrincipalName value + */ + public String userPrincipalName() { + return this.userPrincipalName; + } + + /** + * Set the principal name of the object. + * + * @param userPrincipalName the userPrincipalName value to set + * @return the AADObjectInner object itself. + */ + public AADObjectInner withUserPrincipalName(String userPrincipalName) { + this.userPrincipalName = userPrincipalName; + return this; + } + + /** + * Get the primary email address of the object. + * + * @return the mail value + */ + public String mail() { + return this.mail; + } + + /** + * Set the primary email address of the object. + * + * @param mail the mail value to set + * @return the AADObjectInner object itself. + */ + public AADObjectInner withMail(String mail) { + this.mail = mail; + return this; + } + + /** + * Get whether the AAD object is mail-enabled. + * + * @return the mailEnabled value + */ + public Boolean mailEnabled() { + return this.mailEnabled; + } + + /** + * Set whether the AAD object is mail-enabled. + * + * @param mailEnabled the mailEnabled value to set + * @return the AADObjectInner object itself. + */ + public AADObjectInner withMailEnabled(Boolean mailEnabled) { + this.mailEnabled = mailEnabled; + return this; + } + + /** + * Get the mail alias for the user. + * + * @return the mailNickname value + */ + public String mailNickname() { + return this.mailNickname; + } + + /** + * Get whether the AAD object is security-enabled. + * + * @return the securityEnabled value + */ + public Boolean securityEnabled() { + return this.securityEnabled; + } + + /** + * Set whether the AAD object is security-enabled. + * + * @param securityEnabled the securityEnabled value to set + * @return the AADObjectInner object itself. + */ + public AADObjectInner withSecurityEnabled(Boolean securityEnabled) { + this.securityEnabled = securityEnabled; + return this; + } + + /** + * Get the sign-in name of the object. + * + * @return the signInName value + */ + public String signInName() { + return this.signInName; + } + + /** + * Set the sign-in name of the object. + * + * @param signInName the signInName value to set + * @return the AADObjectInner object itself. + */ + public AADObjectInner withSignInName(String signInName) { + this.signInName = signInName; + return this; + } + + /** + * Get a collection of service principal names associated with the object. + * + * @return the servicePrincipalNames value + */ + public List servicePrincipalNames() { + return this.servicePrincipalNames; + } + + /** + * Set a collection of service principal names associated with the object. + * + * @param servicePrincipalNames the servicePrincipalNames value to set + * @return the AADObjectInner object itself. + */ + public AADObjectInner withServicePrincipalNames(List servicePrincipalNames) { + this.servicePrincipalNames = servicePrincipalNames; + return this; + } + + /** + * Get the user type of the object. + * + * @return the userType value + */ + public String userType() { + return this.userType; + } + + /** + * Set the user type of the object. + * + * @param userType the userType value to set + * @return the AADObjectInner object itself. + */ + public AADObjectInner withUserType(String userType) { + this.userType = userType; + return this; + } + + /** + * Get a two letter country code (ISO standard 3166). Required for users that will be assigned licenses due to legal requirement to check for availability of services in countries. Examples include: "US", "JP", and "GB". + * + * @return the usageLocation value + */ + public String usageLocation() { + return this.usageLocation; + } + + /** + * Get the application ID. + * + * @return the appId value + */ + public String appId() { + return this.appId; + } + + /** + * Get the application permissions. + * + * @return the appPermissions value + */ + public List appPermissions() { + return this.appPermissions; + } + + /** + * Get whether the application is be available to other tenants. + * + * @return the availableToOtherTenants value + */ + public Boolean availableToOtherTenants() { + return this.availableToOtherTenants; + } + + /** + * Get a collection of URIs for the application. + * + * @return the identifierUris value + */ + public List identifierUris() { + return this.identifierUris; + } + + /** + * Get a collection of reply URLs for the application. + * + * @return the replyUrls value + */ + public List replyUrls() { + return this.replyUrls; + } + + /** + * Get the home page of the application. + * + * @return the homepage value + */ + public String homepage() { + return this.homepage; + } + +} diff --git a/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/ADGroupInner.java b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/ADGroupInner.java new file mode 100644 index 000000000000..b3bd9f764736 --- /dev/null +++ b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/ADGroupInner.java @@ -0,0 +1,99 @@ +/** + * 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; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * Active Directory group information. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "objectType") +@JsonTypeName("Group") +public class ADGroupInner extends DirectoryObjectInner { + /** + * The display name of the group. + */ + @JsonProperty(value = "displayName") + private String displayName; + + /** + * Whether the group is security-enable. + */ + @JsonProperty(value = "securityEnabled") + private Boolean securityEnabled; + + /** + * The primary email address of the group. + */ + @JsonProperty(value = "mail") + private String mail; + + /** + * Get the display name of the group. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the display name of the group. + * + * @param displayName the displayName value to set + * @return the ADGroupInner object itself. + */ + public ADGroupInner withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get whether the group is security-enable. + * + * @return the securityEnabled value + */ + public Boolean securityEnabled() { + return this.securityEnabled; + } + + /** + * Set whether the group is security-enable. + * + * @param securityEnabled the securityEnabled value to set + * @return the ADGroupInner object itself. + */ + public ADGroupInner withSecurityEnabled(Boolean securityEnabled) { + this.securityEnabled = securityEnabled; + return this; + } + + /** + * Get the primary email address of the group. + * + * @return the mail value + */ + public String mail() { + return this.mail; + } + + /** + * Set the primary email address of the group. + * + * @param mail the mail value to set + * @return the ADGroupInner object itself. + */ + public ADGroupInner withMail(String mail) { + this.mail = mail; + return this; + } + +} diff --git a/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/ApplicationInner.java b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/ApplicationInner.java new file mode 100644 index 000000000000..9d44bf0bb89a --- /dev/null +++ b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/ApplicationInner.java @@ -0,0 +1,230 @@ +/** + * 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 java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * Active Directory application information. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "objectType") +@JsonTypeName("Application") +public class ApplicationInner extends DirectoryObjectInner { + /** + * The application ID. + */ + @JsonProperty(value = "appId") + private String appId; + + /** + * The application permissions. + */ + @JsonProperty(value = "appPermissions") + private List appPermissions; + + /** + * Whether the application is be available to other tenants. + */ + @JsonProperty(value = "availableToOtherTenants") + private Boolean availableToOtherTenants; + + /** + * The display name of the application. + */ + @JsonProperty(value = "displayName") + private String displayName; + + /** + * A collection of URIs for the application. + */ + @JsonProperty(value = "identifierUris") + private List identifierUris; + + /** + * A collection of reply URLs for the application. + */ + @JsonProperty(value = "replyUrls") + private List replyUrls; + + /** + * The home page of the application. + */ + @JsonProperty(value = "homepage") + private String homepage; + + /** + * Whether to allow implicit grant flow for OAuth2. + */ + @JsonProperty(value = "oauth2AllowImplicitFlow") + private Boolean oauth2AllowImplicitFlow; + + /** + * Get the application ID. + * + * @return the appId value + */ + public String appId() { + return this.appId; + } + + /** + * Set the application ID. + * + * @param appId the appId value to set + * @return the ApplicationInner object itself. + */ + public ApplicationInner withAppId(String appId) { + this.appId = appId; + return this; + } + + /** + * Get the application permissions. + * + * @return the appPermissions value + */ + public List appPermissions() { + return this.appPermissions; + } + + /** + * Set the application permissions. + * + * @param appPermissions the appPermissions value to set + * @return the ApplicationInner object itself. + */ + public ApplicationInner withAppPermissions(List appPermissions) { + this.appPermissions = appPermissions; + return this; + } + + /** + * Get whether the application is be available to other tenants. + * + * @return the availableToOtherTenants value + */ + public Boolean availableToOtherTenants() { + return this.availableToOtherTenants; + } + + /** + * Set whether the application is be available to other tenants. + * + * @param availableToOtherTenants the availableToOtherTenants value to set + * @return the ApplicationInner object itself. + */ + public ApplicationInner withAvailableToOtherTenants(Boolean availableToOtherTenants) { + this.availableToOtherTenants = availableToOtherTenants; + return this; + } + + /** + * Get the display name of the application. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the display name of the application. + * + * @param displayName the displayName value to set + * @return the ApplicationInner object itself. + */ + public ApplicationInner withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get a collection of URIs for the application. + * + * @return the identifierUris value + */ + public List identifierUris() { + return this.identifierUris; + } + + /** + * Set a collection of URIs for the application. + * + * @param identifierUris the identifierUris value to set + * @return the ApplicationInner object itself. + */ + public ApplicationInner withIdentifierUris(List identifierUris) { + this.identifierUris = identifierUris; + return this; + } + + /** + * Get a collection of reply URLs for the application. + * + * @return the replyUrls value + */ + public List replyUrls() { + return this.replyUrls; + } + + /** + * Set a collection of reply URLs for the application. + * + * @param replyUrls the replyUrls value to set + * @return the ApplicationInner object itself. + */ + public ApplicationInner withReplyUrls(List replyUrls) { + this.replyUrls = replyUrls; + return this; + } + + /** + * Get the home page of the application. + * + * @return the homepage value + */ + public String homepage() { + return this.homepage; + } + + /** + * Set the home page of the application. + * + * @param homepage the homepage value to set + * @return the ApplicationInner object itself. + */ + public ApplicationInner withHomepage(String homepage) { + this.homepage = homepage; + return this; + } + + /** + * Get whether to allow implicit grant flow for OAuth2. + * + * @return the oauth2AllowImplicitFlow value + */ + public Boolean oauth2AllowImplicitFlow() { + return this.oauth2AllowImplicitFlow; + } + + /** + * Set whether to allow implicit grant flow for OAuth2. + * + * @param oauth2AllowImplicitFlow the oauth2AllowImplicitFlow value to set + * @return the ApplicationInner object itself. + */ + public ApplicationInner withOauth2AllowImplicitFlow(Boolean oauth2AllowImplicitFlow) { + this.oauth2AllowImplicitFlow = oauth2AllowImplicitFlow; + return this; + } + +} diff --git a/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/ApplicationsInner.java b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/ApplicationsInner.java new file mode 100644 index 000000000000..6018e33ac36f --- /dev/null +++ b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/ApplicationsInner.java @@ -0,0 +1,1291 @@ +/** + * 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.AzureServiceFuture; +import com.microsoft.azure.graphrbac.ApplicationAddOwnerParameters; +import com.microsoft.azure.graphrbac.ApplicationCreateParameters; +import com.microsoft.azure.graphrbac.ApplicationUpdateParameters; +import com.microsoft.azure.graphrbac.GraphErrorException; +import com.microsoft.azure.graphrbac.KeyCredentialsUpdateParameters; +import com.microsoft.azure.graphrbac.PasswordCredentialsUpdateParameters; +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; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.PATCH; +import retrofit2.http.Path; +import retrofit2.http.POST; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Applications. + */ +public class ApplicationsInner { + /** The Retrofit service to perform REST calls. */ + private ApplicationsService service; + /** The service client containing this operation class. */ + private GraphRbacManagementClientImpl client; + + /** + * Initializes an instance of ApplicationsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ApplicationsInner(Retrofit retrofit, GraphRbacManagementClientImpl client) { + this.service = retrofit.create(ApplicationsService.class); + this.client = client; + } + + /** + * The interface defining all the services for Applications to be + * used by Retrofit to perform actually REST calls. + */ + interface ApplicationsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.graphrbac.Applications create" }) + @POST("{tenantID}/applications") + Observable> create(@Path("tenantID") String tenantID, @Body ApplicationCreateParameters parameters, @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.graphrbac.Applications list" }) + @GET("{tenantID}/applications") + Observable> list(@Path("tenantID") String tenantID, @Query("$filter") String filter, @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.graphrbac.Applications delete" }) + @HTTP(path = "{tenantID}/applications/{applicationObjectId}", method = "DELETE", hasBody = true) + Observable> delete(@Path("applicationObjectId") String applicationObjectId, @Path("tenantID") String tenantID, @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.graphrbac.Applications get" }) + @GET("{tenantID}/applications/{applicationObjectId}") + Observable> get(@Path("applicationObjectId") String applicationObjectId, @Path("tenantID") String tenantID, @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.graphrbac.Applications patch" }) + @PATCH("{tenantID}/applications/{applicationObjectId}") + Observable> patch(@Path("applicationObjectId") String applicationObjectId, @Path("tenantID") String tenantID, @Body ApplicationUpdateParameters parameters, @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.graphrbac.Applications listOwners" }) + @GET("{tenantID}/applications/{applicationObjectId}/owners") + Observable> listOwners(@Path("applicationObjectId") String applicationObjectId, @Path("tenantID") String tenantID, @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.graphrbac.Applications addOwner" }) + @POST("{tenantID}/applications/{applicationObjectId}/$links/owners") + Observable> addOwner(@Path("applicationObjectId") String applicationObjectId, @Path("tenantID") String tenantID, @Body ApplicationAddOwnerParameters parameters, @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.graphrbac.Applications listKeyCredentials" }) + @GET("{tenantID}/applications/{applicationObjectId}/keyCredentials") + Observable> listKeyCredentials(@Path("applicationObjectId") String applicationObjectId, @Path("tenantID") String tenantID, @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.graphrbac.Applications updateKeyCredentials" }) + @PATCH("{tenantID}/applications/{applicationObjectId}/keyCredentials") + Observable> updateKeyCredentials(@Path("applicationObjectId") String applicationObjectId, @Path("tenantID") String tenantID, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body KeyCredentialsUpdateParameters parameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.graphrbac.Applications listPasswordCredentials" }) + @GET("{tenantID}/applications/{applicationObjectId}/passwordCredentials") + Observable> listPasswordCredentials(@Path("applicationObjectId") String applicationObjectId, @Path("tenantID") String tenantID, @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.graphrbac.Applications updatePasswordCredentials" }) + @PATCH("{tenantID}/applications/{applicationObjectId}/passwordCredentials") + Observable> updatePasswordCredentials(@Path("applicationObjectId") String applicationObjectId, @Path("tenantID") String tenantID, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body PasswordCredentialsUpdateParameters parameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.graphrbac.Applications listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Create a new application. + * + * @param parameters The parameters for creating an application. + * @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 ApplicationInner object if successful. + */ + public ApplicationInner create(ApplicationCreateParameters parameters) { + return createWithServiceResponseAsync(parameters).toBlocking().single().body(); + } + + /** + * Create a new application. + * + * @param parameters The parameters for creating an application. + * @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 createAsync(ApplicationCreateParameters parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createWithServiceResponseAsync(parameters), serviceCallback); + } + + /** + * Create a new application. + * + * @param parameters The parameters for creating an application. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ApplicationInner object + */ + public Observable createAsync(ApplicationCreateParameters parameters) { + return createWithServiceResponseAsync(parameters).map(new Func1, ApplicationInner>() { + @Override + public ApplicationInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create a new application. + * + * @param parameters The parameters for creating an application. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ApplicationInner object + */ + public Observable> createWithServiceResponseAsync(ApplicationCreateParameters parameters) { + if (this.client.tenantID() == null) { + throw new IllegalArgumentException("Parameter this.client.tenantID() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + return service.create(this.client.tenantID(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createDelegate(Response response) throws GraphErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(201, new TypeToken() { }.getType()) + .registerError(GraphErrorException.class) + .build(response); + } + + /** + * Lists applications by filter parameters. + * + * @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 PagedList<ApplicationInner> object if successful. + */ + public PagedList list() { + ServiceResponse> response = listSinglePageAsync().toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextLink) { + return listNextSinglePageAsync(nextLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists applications by filter parameters. + * + * @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> listAsync(final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(), + new Func1>>>() { + @Override + public Observable>> call(String nextLink) { + return listNextSinglePageAsync(nextLink); + } + }, + serviceCallback); + } + + /** + * Lists applications by filter parameters. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ApplicationInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists applications by filter parameters. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ApplicationInner> object + */ + public Observable>> listWithServiceResponseAsync() { + return listSinglePageAsync() + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextLink = page.body().nextPageLink(); + if (nextLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextLink)); + } + }); + } + + /** + * Lists applications by filter parameters. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ApplicationInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync() { + if (this.client.tenantID() == null) { + throw new IllegalArgumentException("Parameter this.client.tenantID() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String filter = null; + return service.list(this.client.tenantID(), filter, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists applications by filter parameters. + * + * @param filter The filters to apply to the operation. + * @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 PagedList<ApplicationInner> object if successful. + */ + public PagedList list(final String filter) { + ServiceResponse> response = listSinglePageAsync(filter).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextLink) { + return listNextSinglePageAsync(nextLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists applications by filter parameters. + * + * @param filter The filters to apply to the 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> listAsync(final String filter, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(filter), + new Func1>>>() { + @Override + public Observable>> call(String nextLink) { + return listNextSinglePageAsync(nextLink); + } + }, + serviceCallback); + } + + /** + * Lists applications by filter parameters. + * + * @param filter The filters to apply to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ApplicationInner> object + */ + public Observable> listAsync(final String filter) { + return listWithServiceResponseAsync(filter) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists applications by filter parameters. + * + * @param filter The filters to apply to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ApplicationInner> object + */ + public Observable>> listWithServiceResponseAsync(final String filter) { + return listSinglePageAsync(filter) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextLink = page.body().nextPageLink(); + if (nextLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextLink)); + } + }); + } + + /** + * Lists applications by filter parameters. + * + ServiceResponse> * @param filter The filters to apply to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ApplicationInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final String filter) { + if (this.client.tenantID() == null) { + throw new IllegalArgumentException("Parameter this.client.tenantID() 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.list(this.client.tenantID(), filter, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws GraphErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., GraphErrorException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(GraphErrorException.class) + .build(response); + } + + /** + * Delete an application. + * + * @param applicationObjectId Application object ID. + * @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 + */ + public void delete(String applicationObjectId) { + deleteWithServiceResponseAsync(applicationObjectId).toBlocking().single().body(); + } + + /** + * Delete an application. + * + * @param applicationObjectId Application object 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 deleteAsync(String applicationObjectId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(applicationObjectId), serviceCallback); + } + + /** + * Delete an application. + * + * @param applicationObjectId Application object ID. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String applicationObjectId) { + return deleteWithServiceResponseAsync(applicationObjectId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Delete an application. + * + * @param applicationObjectId Application object ID. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String applicationObjectId) { + if (applicationObjectId == null) { + throw new IllegalArgumentException("Parameter applicationObjectId is required and cannot be null."); + } + if (this.client.tenantID() == null) { + throw new IllegalArgumentException("Parameter this.client.tenantID() 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.delete(applicationObjectId, this.client.tenantID(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(Response response) throws GraphErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(204, new TypeToken() { }.getType()) + .registerError(GraphErrorException.class) + .build(response); + } + + /** + * Get an application by object ID. + * + * @param applicationObjectId Application object ID. + * @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 ApplicationInner object if successful. + */ + public ApplicationInner get(String applicationObjectId) { + return getWithServiceResponseAsync(applicationObjectId).toBlocking().single().body(); + } + + /** + * Get an application by object ID. + * + * @param applicationObjectId Application object 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 getAsync(String applicationObjectId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(applicationObjectId), serviceCallback); + } + + /** + * Get an application by object ID. + * + * @param applicationObjectId Application object ID. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ApplicationInner object + */ + public Observable getAsync(String applicationObjectId) { + return getWithServiceResponseAsync(applicationObjectId).map(new Func1, ApplicationInner>() { + @Override + public ApplicationInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Get an application by object ID. + * + * @param applicationObjectId Application object ID. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ApplicationInner object + */ + public Observable> getWithServiceResponseAsync(String applicationObjectId) { + if (applicationObjectId == null) { + throw new IllegalArgumentException("Parameter applicationObjectId is required and cannot be null."); + } + if (this.client.tenantID() == null) { + throw new IllegalArgumentException("Parameter this.client.tenantID() 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(applicationObjectId, this.client.tenantID(), 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 GraphErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(GraphErrorException.class) + .build(response); + } + + /** + * Update an existing application. + * + * @param applicationObjectId Application object ID. + * @param parameters Parameters to update an existing application. + * @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 + */ + public void patch(String applicationObjectId, ApplicationUpdateParameters parameters) { + patchWithServiceResponseAsync(applicationObjectId, parameters).toBlocking().single().body(); + } + + /** + * Update an existing application. + * + * @param applicationObjectId Application object ID. + * @param parameters Parameters to update an existing application. + * @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 patchAsync(String applicationObjectId, ApplicationUpdateParameters parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(patchWithServiceResponseAsync(applicationObjectId, parameters), serviceCallback); + } + + /** + * Update an existing application. + * + * @param applicationObjectId Application object ID. + * @param parameters Parameters to update an existing application. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable patchAsync(String applicationObjectId, ApplicationUpdateParameters parameters) { + return patchWithServiceResponseAsync(applicationObjectId, parameters).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Update an existing application. + * + * @param applicationObjectId Application object ID. + * @param parameters Parameters to update an existing application. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> patchWithServiceResponseAsync(String applicationObjectId, ApplicationUpdateParameters parameters) { + if (applicationObjectId == null) { + throw new IllegalArgumentException("Parameter applicationObjectId is required and cannot be null."); + } + if (this.client.tenantID() == null) { + throw new IllegalArgumentException("Parameter this.client.tenantID() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + return service.patch(applicationObjectId, this.client.tenantID(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = patchDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse patchDelegate(Response response) throws GraphErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(204, new TypeToken() { }.getType()) + .registerError(GraphErrorException.class) + .build(response); + } + + /** + * Directory objects that are owners of the application. + * The owners are a set of non-admin users who are allowed to modify this object. + * + * @param applicationObjectId The object ID of the application for which to get owners. + * @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 List<DirectoryObjectInner> object if successful. + */ + public List listOwners(String applicationObjectId) { + return listOwnersWithServiceResponseAsync(applicationObjectId).toBlocking().single().body(); + } + + /** + * Directory objects that are owners of the application. + * The owners are a set of non-admin users who are allowed to modify this object. + * + * @param applicationObjectId The object ID of the application for which to get owners. + * @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> listOwnersAsync(String applicationObjectId, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listOwnersWithServiceResponseAsync(applicationObjectId), serviceCallback); + } + + /** + * Directory objects that are owners of the application. + * The owners are a set of non-admin users who are allowed to modify this object. + * + * @param applicationObjectId The object ID of the application for which to get owners. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<DirectoryObjectInner> object + */ + public Observable> listOwnersAsync(String applicationObjectId) { + return listOwnersWithServiceResponseAsync(applicationObjectId).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Directory objects that are owners of the application. + * The owners are a set of non-admin users who are allowed to modify this object. + * + * @param applicationObjectId The object ID of the application for which to get owners. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<DirectoryObjectInner> object + */ + public Observable>> listOwnersWithServiceResponseAsync(String applicationObjectId) { + if (applicationObjectId == null) { + throw new IllegalArgumentException("Parameter applicationObjectId is required and cannot be null."); + } + if (this.client.tenantID() == null) { + throw new IllegalArgumentException("Parameter this.client.tenantID() 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.listOwners(applicationObjectId, this.client.tenantID(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listOwnersDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listOwnersDelegate(Response response) throws GraphErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., GraphErrorException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(GraphErrorException.class) + .build(response); + } + + /** + * Add an owner to an application. + * + * @param applicationObjectId The object ID of the application to which to add the owner. + * @param parameters The URL of the owner object, such as https://graph.windows.net/0b1f9851-1bf0-433f-aec3-cb9272f093dc/directoryObjects/f260bbc4-c254-447b-94cf-293b5ec434dd. + * @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 + */ + public void addOwner(String applicationObjectId, ApplicationAddOwnerParameters parameters) { + addOwnerWithServiceResponseAsync(applicationObjectId, parameters).toBlocking().single().body(); + } + + /** + * Add an owner to an application. + * + * @param applicationObjectId The object ID of the application to which to add the owner. + * @param parameters The URL of the owner object, such as https://graph.windows.net/0b1f9851-1bf0-433f-aec3-cb9272f093dc/directoryObjects/f260bbc4-c254-447b-94cf-293b5ec434dd. + * @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 addOwnerAsync(String applicationObjectId, ApplicationAddOwnerParameters parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(addOwnerWithServiceResponseAsync(applicationObjectId, parameters), serviceCallback); + } + + /** + * Add an owner to an application. + * + * @param applicationObjectId The object ID of the application to which to add the owner. + * @param parameters The URL of the owner object, such as https://graph.windows.net/0b1f9851-1bf0-433f-aec3-cb9272f093dc/directoryObjects/f260bbc4-c254-447b-94cf-293b5ec434dd. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable addOwnerAsync(String applicationObjectId, ApplicationAddOwnerParameters parameters) { + return addOwnerWithServiceResponseAsync(applicationObjectId, parameters).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Add an owner to an application. + * + * @param applicationObjectId The object ID of the application to which to add the owner. + * @param parameters The URL of the owner object, such as https://graph.windows.net/0b1f9851-1bf0-433f-aec3-cb9272f093dc/directoryObjects/f260bbc4-c254-447b-94cf-293b5ec434dd. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> addOwnerWithServiceResponseAsync(String applicationObjectId, ApplicationAddOwnerParameters parameters) { + if (applicationObjectId == null) { + throw new IllegalArgumentException("Parameter applicationObjectId is required and cannot be null."); + } + if (this.client.tenantID() == null) { + throw new IllegalArgumentException("Parameter this.client.tenantID() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + return service.addOwner(applicationObjectId, this.client.tenantID(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = addOwnerDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse addOwnerDelegate(Response response) throws GraphErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(204, new TypeToken() { }.getType()) + .registerError(GraphErrorException.class) + .build(response); + } + + /** + * Get the keyCredentials associated with an application. + * + * @param applicationObjectId Application object ID. + * @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 List<KeyCredentialInner> object if successful. + */ + public List listKeyCredentials(String applicationObjectId) { + return listKeyCredentialsWithServiceResponseAsync(applicationObjectId).toBlocking().single().body(); + } + + /** + * Get the keyCredentials associated with an application. + * + * @param applicationObjectId Application object 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> listKeyCredentialsAsync(String applicationObjectId, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listKeyCredentialsWithServiceResponseAsync(applicationObjectId), serviceCallback); + } + + /** + * Get the keyCredentials associated with an application. + * + * @param applicationObjectId Application object ID. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<KeyCredentialInner> object + */ + public Observable> listKeyCredentialsAsync(String applicationObjectId) { + return listKeyCredentialsWithServiceResponseAsync(applicationObjectId).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Get the keyCredentials associated with an application. + * + * @param applicationObjectId Application object ID. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<KeyCredentialInner> object + */ + public Observable>> listKeyCredentialsWithServiceResponseAsync(String applicationObjectId) { + if (applicationObjectId == null) { + throw new IllegalArgumentException("Parameter applicationObjectId is required and cannot be null."); + } + if (this.client.tenantID() == null) { + throw new IllegalArgumentException("Parameter this.client.tenantID() 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.listKeyCredentials(applicationObjectId, this.client.tenantID(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listKeyCredentialsDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listKeyCredentialsDelegate(Response response) throws GraphErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., GraphErrorException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(GraphErrorException.class) + .build(response); + } + + /** + * Update the keyCredentials associated with an application. + * + * @param applicationObjectId Application object ID. + * @param value A collection of KeyCredentials. + * @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 + */ + public void updateKeyCredentials(String applicationObjectId, List value) { + updateKeyCredentialsWithServiceResponseAsync(applicationObjectId, value).toBlocking().single().body(); + } + + /** + * Update the keyCredentials associated with an application. + * + * @param applicationObjectId Application object ID. + * @param value A collection of KeyCredentials. + * @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 updateKeyCredentialsAsync(String applicationObjectId, List value, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateKeyCredentialsWithServiceResponseAsync(applicationObjectId, value), serviceCallback); + } + + /** + * Update the keyCredentials associated with an application. + * + * @param applicationObjectId Application object ID. + * @param value A collection of KeyCredentials. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable updateKeyCredentialsAsync(String applicationObjectId, List value) { + return updateKeyCredentialsWithServiceResponseAsync(applicationObjectId, value).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Update the keyCredentials associated with an application. + * + * @param applicationObjectId Application object ID. + * @param value A collection of KeyCredentials. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> updateKeyCredentialsWithServiceResponseAsync(String applicationObjectId, List value) { + if (applicationObjectId == null) { + throw new IllegalArgumentException("Parameter applicationObjectId is required and cannot be null."); + } + if (this.client.tenantID() == null) { + throw new IllegalArgumentException("Parameter this.client.tenantID() 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 (value == null) { + throw new IllegalArgumentException("Parameter value is required and cannot be null."); + } + Validator.validate(value); + KeyCredentialsUpdateParameters parameters = new KeyCredentialsUpdateParameters(); + parameters.withValue(value); + return service.updateKeyCredentials(applicationObjectId, this.client.tenantID(), this.client.apiVersion(), this.client.acceptLanguage(), parameters, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = updateKeyCredentialsDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse updateKeyCredentialsDelegate(Response response) throws GraphErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(204, new TypeToken() { }.getType()) + .registerError(GraphErrorException.class) + .build(response); + } + + /** + * Get the passwordCredentials associated with an application. + * + * @param applicationObjectId Application object ID. + * @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 List<PasswordCredentialInner> object if successful. + */ + public List listPasswordCredentials(String applicationObjectId) { + return listPasswordCredentialsWithServiceResponseAsync(applicationObjectId).toBlocking().single().body(); + } + + /** + * Get the passwordCredentials associated with an application. + * + * @param applicationObjectId Application object 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> listPasswordCredentialsAsync(String applicationObjectId, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listPasswordCredentialsWithServiceResponseAsync(applicationObjectId), serviceCallback); + } + + /** + * Get the passwordCredentials associated with an application. + * + * @param applicationObjectId Application object ID. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<PasswordCredentialInner> object + */ + public Observable> listPasswordCredentialsAsync(String applicationObjectId) { + return listPasswordCredentialsWithServiceResponseAsync(applicationObjectId).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Get the passwordCredentials associated with an application. + * + * @param applicationObjectId Application object ID. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<PasswordCredentialInner> object + */ + public Observable>> listPasswordCredentialsWithServiceResponseAsync(String applicationObjectId) { + if (applicationObjectId == null) { + throw new IllegalArgumentException("Parameter applicationObjectId is required and cannot be null."); + } + if (this.client.tenantID() == null) { + throw new IllegalArgumentException("Parameter this.client.tenantID() 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.listPasswordCredentials(applicationObjectId, this.client.tenantID(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listPasswordCredentialsDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listPasswordCredentialsDelegate(Response response) throws GraphErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., GraphErrorException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(GraphErrorException.class) + .build(response); + } + + /** + * Update passwordCredentials associated with an application. + * + * @param applicationObjectId Application object ID. + * @param value A collection of PasswordCredentials. + * @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 + */ + public void updatePasswordCredentials(String applicationObjectId, List value) { + updatePasswordCredentialsWithServiceResponseAsync(applicationObjectId, value).toBlocking().single().body(); + } + + /** + * Update passwordCredentials associated with an application. + * + * @param applicationObjectId Application object ID. + * @param value A collection of PasswordCredentials. + * @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 updatePasswordCredentialsAsync(String applicationObjectId, List value, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updatePasswordCredentialsWithServiceResponseAsync(applicationObjectId, value), serviceCallback); + } + + /** + * Update passwordCredentials associated with an application. + * + * @param applicationObjectId Application object ID. + * @param value A collection of PasswordCredentials. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable updatePasswordCredentialsAsync(String applicationObjectId, List value) { + return updatePasswordCredentialsWithServiceResponseAsync(applicationObjectId, value).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Update passwordCredentials associated with an application. + * + * @param applicationObjectId Application object ID. + * @param value A collection of PasswordCredentials. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> updatePasswordCredentialsWithServiceResponseAsync(String applicationObjectId, List value) { + if (applicationObjectId == null) { + throw new IllegalArgumentException("Parameter applicationObjectId is required and cannot be null."); + } + if (this.client.tenantID() == null) { + throw new IllegalArgumentException("Parameter this.client.tenantID() 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 (value == null) { + throw new IllegalArgumentException("Parameter value is required and cannot be null."); + } + Validator.validate(value); + PasswordCredentialsUpdateParameters parameters = new PasswordCredentialsUpdateParameters(); + parameters.withValue(value); + return service.updatePasswordCredentials(applicationObjectId, this.client.tenantID(), this.client.apiVersion(), this.client.acceptLanguage(), parameters, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = updatePasswordCredentialsDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse updatePasswordCredentialsDelegate(Response response) throws GraphErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(204, new TypeToken() { }.getType()) + .registerError(GraphErrorException.class) + .build(response); + } + + /** + * Gets a list of applications from the current tenant. + * + * @param nextLink Next link for the list operation. + * @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 PagedList<ApplicationInner> object if successful. + */ + public PagedList listNext(final String nextLink) { + ServiceResponse> response = listNextSinglePageAsync(nextLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextLink) { + return listNextSinglePageAsync(nextLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets a list of applications from the current tenant. + * + * @param nextLink Next link for the 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> listNextAsync(final String nextLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextLink), + new Func1>>>() { + @Override + public Observable>> call(String nextLink) { + return listNextSinglePageAsync(nextLink); + } + }, + serviceCallback); + } + + /** + * Gets a list of applications from the current tenant. + * + * @param nextLink Next link for the list operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ApplicationInner> object + */ + public Observable> listNextAsync(final String nextLink) { + return listNextWithServiceResponseAsync(nextLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a list of applications from the current tenant. + * + * @param nextLink Next link for the list operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ApplicationInner> object + */ + public Observable>> listNextWithServiceResponseAsync(final String nextLink) { + return listNextSinglePageAsync(nextLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextLink = page.body().nextPageLink(); + if (nextLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextLink)); + } + }); + } + + /** + * Gets a list of applications from the current tenant. + * + ServiceResponse> * @param nextLink Next link for the list operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ApplicationInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listNextSinglePageAsync(final String nextLink) { + if (nextLink == null) { + throw new IllegalArgumentException("Parameter nextLink is required and cannot be null."); + } + if (this.client.tenantID() == null) { + throw new IllegalArgumentException("Parameter this.client.tenantID() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + String nextUrl = String.format("%s/%s", this.client.tenantID(), nextLink); + return service.listNext(nextUrl, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listNextDelegate(Response response) throws GraphErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., GraphErrorException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(GraphErrorException.class) + .build(response); + } + +} diff --git a/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/CheckGroupMembershipResultInner.java b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/CheckGroupMembershipResultInner.java new file mode 100644 index 000000000000..b2b9f7fc674f --- /dev/null +++ b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/CheckGroupMembershipResultInner.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.graphrbac.implementation; + +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Server response for IsMemberOf API call. + */ +public class CheckGroupMembershipResultInner { + /** + * Unmatched properties from the message are deserialized this collection. + */ + @JsonProperty(value = "") + private Map additionalProperties; + + /** + * True if the specified user, group, contact, or service principal has + * either direct or transitive membership in the specified group; + * otherwise, false. + */ + @JsonProperty(value = "value") + private Boolean value; + + /** + * Get unmatched properties from the message are deserialized this collection. + * + * @return the additionalProperties value + */ + public Map additionalProperties() { + return this.additionalProperties; + } + + /** + * Set unmatched properties from the message are deserialized this collection. + * + * @param additionalProperties the additionalProperties value to set + * @return the CheckGroupMembershipResultInner object itself. + */ + public CheckGroupMembershipResultInner withAdditionalProperties(Map additionalProperties) { + this.additionalProperties = additionalProperties; + return this; + } + + /** + * Get true if the specified user, group, contact, or service principal has either direct or transitive membership in the specified group; otherwise, false. + * + * @return the value value + */ + public Boolean value() { + return this.value; + } + + /** + * Set true if the specified user, group, contact, or service principal has either direct or transitive membership in the specified group; otherwise, false. + * + * @param value the value value to set + * @return the CheckGroupMembershipResultInner object itself. + */ + public CheckGroupMembershipResultInner withValue(Boolean value) { + this.value = value; + return this; + } + +} diff --git a/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/DirectoryObjectInner.java b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/DirectoryObjectInner.java new file mode 100644 index 000000000000..e3c65deb62d0 --- /dev/null +++ b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/DirectoryObjectInner.java @@ -0,0 +1,86 @@ +/** + * 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 java.util.Map; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonSubTypes; + +/** + * Represents an Azure Active Directory object. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "objectType") +@JsonTypeName("DirectoryObject") +@JsonSubTypes({ + @JsonSubTypes.Type(name = "Application", value = ApplicationInner.class), + @JsonSubTypes.Type(name = "Group", value = ADGroupInner.class), + @JsonSubTypes.Type(name = "ServicePrincipal", value = ServicePrincipalInner.class), + @JsonSubTypes.Type(name = "User", value = UserInner.class) +}) +public class DirectoryObjectInner { + /** + * Unmatched properties from the message are deserialized this collection. + */ + @JsonProperty(value = "") + private Map additionalProperties; + + /** + * The object ID. + */ + @JsonProperty(value = "objectId", access = JsonProperty.Access.WRITE_ONLY) + private String objectId; + + /** + * The time at which the directory object was deleted. + */ + @JsonProperty(value = "deletionTimestamp", access = JsonProperty.Access.WRITE_ONLY) + private DateTime deletionTimestamp; + + /** + * Get unmatched properties from the message are deserialized this collection. + * + * @return the additionalProperties value + */ + public Map additionalProperties() { + return this.additionalProperties; + } + + /** + * Set unmatched properties from the message are deserialized this collection. + * + * @param additionalProperties the additionalProperties value to set + * @return the DirectoryObjectInner object itself. + */ + public DirectoryObjectInner withAdditionalProperties(Map additionalProperties) { + this.additionalProperties = additionalProperties; + return this; + } + + /** + * Get the object ID. + * + * @return the objectId value + */ + public String objectId() { + return this.objectId; + } + + /** + * Get the time at which the directory object was deleted. + * + * @return the deletionTimestamp value + */ + public DateTime deletionTimestamp() { + return this.deletionTimestamp; + } + +} diff --git a/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/DomainInner.java b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/DomainInner.java new file mode 100644 index 000000000000..ad3946ad0d43 --- /dev/null +++ b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/DomainInner.java @@ -0,0 +1,115 @@ +/** + * 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 java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Active Directory Domain information. + */ +public class DomainInner { + /** + * Unmatched properties from the message are deserialized this collection. + */ + @JsonProperty(value = "") + private Map additionalProperties; + + /** + * the type of the authentication into the domain. + */ + @JsonProperty(value = "authenticationType", access = JsonProperty.Access.WRITE_ONLY) + private String authenticationType; + + /** + * if this is the default domain in the tenant. + */ + @JsonProperty(value = "isDefault", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isDefault; + + /** + * if this domain's ownership is verified. + */ + @JsonProperty(value = "isVerified", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isVerified; + + /** + * the domain name. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /** + * Get unmatched properties from the message are deserialized this collection. + * + * @return the additionalProperties value + */ + public Map additionalProperties() { + return this.additionalProperties; + } + + /** + * Set unmatched properties from the message are deserialized this collection. + * + * @param additionalProperties the additionalProperties value to set + * @return the DomainInner object itself. + */ + public DomainInner withAdditionalProperties(Map additionalProperties) { + this.additionalProperties = additionalProperties; + return this; + } + + /** + * Get the type of the authentication into the domain. + * + * @return the authenticationType value + */ + public String authenticationType() { + return this.authenticationType; + } + + /** + * Get if this is the default domain in the tenant. + * + * @return the isDefault value + */ + public Boolean isDefault() { + return this.isDefault; + } + + /** + * Get if this domain's ownership is verified. + * + * @return the isVerified value + */ + public Boolean isVerified() { + return this.isVerified; + } + + /** + * Get the domain name. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the domain name. + * + * @param name the name value to set + * @return the DomainInner object itself. + */ + public DomainInner withName(String name) { + this.name = name; + return this; + } + +} diff --git a/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/DomainsInner.java b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/DomainsInner.java new file mode 100644 index 000000000000..d6b6a85a096d --- /dev/null +++ b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/DomainsInner.java @@ -0,0 +1,296 @@ +/** + * 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.CloudException; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +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 Domains. + */ +public class DomainsInner { + /** The Retrofit service to perform REST calls. */ + private DomainsService service; + /** The service client containing this operation class. */ + private GraphRbacManagementClientImpl client; + + /** + * Initializes an instance of DomainsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public DomainsInner(Retrofit retrofit, GraphRbacManagementClientImpl client) { + this.service = retrofit.create(DomainsService.class); + this.client = client; + } + + /** + * The interface defining all the services for Domains to be + * used by Retrofit to perform actually REST calls. + */ + interface DomainsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.graphrbac.Domains list" }) + @GET("{tenantID}/domains") + Observable> list(@Path("tenantID") String tenantID, @Query("$filter") String filter, @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.graphrbac.Domains get" }) + @GET("{tenantID}/domains/{domainName}") + Observable> get(@Path("domainName") String domainName, @Path("tenantID") String tenantID, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets a list of domains for the current tenant. + * + * @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 List<DomainInner> object if successful. + */ + public List list() { + return listWithServiceResponseAsync().toBlocking().single().body(); + } + + /** + * Gets a list of domains for 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> listAsync(final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listWithServiceResponseAsync(), serviceCallback); + } + + /** + * Gets a list of domains for the current tenant. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<DomainInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync().map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a list of domains for the current tenant. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<DomainInner> object + */ + public Observable>> listWithServiceResponseAsync() { + if (this.client.tenantID() == null) { + throw new IllegalArgumentException("Parameter this.client.tenantID() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String filter = null; + return service.list(this.client.tenantID(), filter, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Gets a list of domains for the current tenant. + * + * @param filter The filter to apply to the 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 List<DomainInner> object if successful. + */ + public List list(String filter) { + return listWithServiceResponseAsync(filter).toBlocking().single().body(); + } + + /** + * Gets a list of domains for the current tenant. + * + * @param filter The filter to apply to the 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> listAsync(String filter, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listWithServiceResponseAsync(filter), serviceCallback); + } + + /** + * Gets a list of domains for the current tenant. + * + * @param filter The filter to apply to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<DomainInner> object + */ + public Observable> listAsync(String filter) { + return listWithServiceResponseAsync(filter).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a list of domains for the current tenant. + * + * @param filter The filter to apply to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<DomainInner> object + */ + public Observable>> listWithServiceResponseAsync(String filter) { + if (this.client.tenantID() == null) { + throw new IllegalArgumentException("Parameter this.client.tenantID() 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.list(this.client.tenantID(), filter, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets a specific domain in the current tenant. + * + * @param domainName name of the domain. + * @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 DomainInner object if successful. + */ + public DomainInner get(String domainName) { + return getWithServiceResponseAsync(domainName).toBlocking().single().body(); + } + + /** + * Gets a specific domain in the current tenant. + * + * @param domainName name of the domain. + * @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 domainName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(domainName), serviceCallback); + } + + /** + * Gets a specific domain in the current tenant. + * + * @param domainName name of the domain. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DomainInner object + */ + public Observable getAsync(String domainName) { + return getWithServiceResponseAsync(domainName).map(new Func1, DomainInner>() { + @Override + public DomainInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a specific domain in the current tenant. + * + * @param domainName name of the domain. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DomainInner object + */ + public Observable> getWithServiceResponseAsync(String domainName) { + if (domainName == null) { + throw new IllegalArgumentException("Parameter domainName is required and cannot be null."); + } + if (this.client.tenantID() == null) { + throw new IllegalArgumentException("Parameter this.client.tenantID() 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(domainName, this.client.tenantID(), 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/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/GraphRbacManagementClientImpl.java b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/GraphRbacManagementClientImpl.java new file mode 100644 index 000000000000..9dce606ca9a9 --- /dev/null +++ b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/GraphRbacManagementClientImpl.java @@ -0,0 +1,280 @@ +/** + * 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.microsoft.azure.AzureClient; +import com.microsoft.azure.AzureServiceClient; +import com.microsoft.rest.credentials.ServiceClientCredentials; +import com.microsoft.rest.RestClient; + +/** + * Initializes a new instance of the GraphRbacManagementClientImpl class. + */ +public class GraphRbacManagementClientImpl extends AzureServiceClient { + /** the {@link AzureClient} used for long running operations. */ + private AzureClient azureClient; + + /** + * Gets the {@link AzureClient} used for long running operations. + * @return the azure client; + */ + public AzureClient getAzureClient() { + return this.azureClient; + } + + /** Client API version. */ + private String apiVersion; + + /** + * Gets Client API version. + * + * @return the apiVersion value. + */ + public String apiVersion() { + return this.apiVersion; + } + + /** The tenant ID. */ + private String tenantID; + + /** + * Gets The tenant ID. + * + * @return the tenantID value. + */ + public String tenantID() { + return this.tenantID; + } + + /** + * Sets The tenant ID. + * + * @param tenantID the tenantID value. + * @return the service client itself + */ + public GraphRbacManagementClientImpl withTenantID(String tenantID) { + this.tenantID = tenantID; + return this; + } + + /** Gets or sets the preferred language for the response. */ + private String acceptLanguage; + + /** + * Gets Gets or sets the preferred language for the response. + * + * @return the acceptLanguage value. + */ + public String acceptLanguage() { + return this.acceptLanguage; + } + + /** + * Sets Gets or sets the preferred language for the response. + * + * @param acceptLanguage the acceptLanguage value. + * @return the service client itself + */ + public GraphRbacManagementClientImpl withAcceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. */ + private int longRunningOperationRetryTimeout; + + /** + * Gets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @return the longRunningOperationRetryTimeout value. + */ + public int longRunningOperationRetryTimeout() { + return this.longRunningOperationRetryTimeout; + } + + /** + * Sets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @param longRunningOperationRetryTimeout the longRunningOperationRetryTimeout value. + * @return the service client itself + */ + public GraphRbacManagementClientImpl withLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout) { + this.longRunningOperationRetryTimeout = longRunningOperationRetryTimeout; + return this; + } + + /** When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. */ + private boolean generateClientRequestId; + + /** + * Gets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @return the generateClientRequestId value. + */ + public boolean generateClientRequestId() { + return this.generateClientRequestId; + } + + /** + * Sets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @param generateClientRequestId the generateClientRequestId value. + * @return the service client itself + */ + public GraphRbacManagementClientImpl withGenerateClientRequestId(boolean generateClientRequestId) { + this.generateClientRequestId = generateClientRequestId; + return this; + } + + /** + * The ObjectsInner object to access its operations. + */ + private ObjectsInner objects; + + /** + * Gets the ObjectsInner object to access its operations. + * @return the ObjectsInner object. + */ + public ObjectsInner objects() { + return this.objects; + } + + /** + * The ApplicationsInner object to access its operations. + */ + private ApplicationsInner applications; + + /** + * Gets the ApplicationsInner object to access its operations. + * @return the ApplicationsInner object. + */ + public ApplicationsInner applications() { + return this.applications; + } + + /** + * The GroupsInner object to access its operations. + */ + private GroupsInner groups; + + /** + * Gets the GroupsInner object to access its operations. + * @return the GroupsInner object. + */ + public GroupsInner groups() { + return this.groups; + } + + /** + * The ServicePrincipalsInner object to access its operations. + */ + private ServicePrincipalsInner servicePrincipals; + + /** + * Gets the ServicePrincipalsInner object to access its operations. + * @return the ServicePrincipalsInner object. + */ + public ServicePrincipalsInner servicePrincipals() { + return this.servicePrincipals; + } + + /** + * The UsersInner object to access its operations. + */ + private UsersInner users; + + /** + * Gets the UsersInner object to access its operations. + * @return the UsersInner object. + */ + public UsersInner users() { + return this.users; + } + + /** + * The DomainsInner object to access its operations. + */ + private DomainsInner domains; + + /** + * Gets the DomainsInner object to access its operations. + * @return the DomainsInner object. + */ + public DomainsInner domains() { + return this.domains; + } + + /** + * The OAuth2sInner object to access its operations. + */ + private OAuth2sInner oAuth2s; + + /** + * Gets the OAuth2sInner object to access its operations. + * @return the OAuth2sInner object. + */ + public OAuth2sInner oAuth2s() { + return this.oAuth2s; + } + + /** + * Initializes an instance of GraphRbacManagementClient client. + * + * @param credentials the management credentials for Azure + */ + public GraphRbacManagementClientImpl(ServiceClientCredentials credentials) { + this("https://graph.windows.net", credentials); + } + + /** + * Initializes an instance of GraphRbacManagementClient client. + * + * @param baseUrl the base URL of the host + * @param credentials the management credentials for Azure + */ + public GraphRbacManagementClientImpl(String baseUrl, ServiceClientCredentials credentials) { + super(baseUrl, credentials); + initialize(); + } + + /** + * Initializes an instance of GraphRbacManagementClient client. + * + * @param restClient the REST client to connect to Azure. + */ + public GraphRbacManagementClientImpl(RestClient restClient) { + super(restClient); + initialize(); + } + + protected void initialize() { + this.apiVersion = "1.6"; + this.acceptLanguage = "en-US"; + this.longRunningOperationRetryTimeout = 30; + this.generateClientRequestId = true; + this.objects = new ObjectsInner(restClient().retrofit(), this); + this.applications = new ApplicationsInner(restClient().retrofit(), this); + this.groups = new GroupsInner(restClient().retrofit(), this); + this.servicePrincipals = new ServicePrincipalsInner(restClient().retrofit(), this); + this.users = new UsersInner(restClient().retrofit(), this); + this.domains = new DomainsInner(restClient().retrofit(), this); + this.oAuth2s = new OAuth2sInner(restClient().retrofit(), this); + this.azureClient = new AzureClient(this); + } + + /** + * Gets the User-Agent header for the client. + * + * @return the user agent string. + */ + @Override + public String userAgent() { + return String.format("%s (%s, %s)", super.userAgent(), "GraphRbacManagementClient", "1.6"); + } +} diff --git a/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/GroupsInner.java b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/GroupsInner.java new file mode 100644 index 000000000000..4a3e2c9cb2ce --- /dev/null +++ b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/GroupsInner.java @@ -0,0 +1,1256 @@ +/** + * 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.AzureServiceFuture; +import com.microsoft.azure.graphrbac.CheckGroupMembershipParameters; +import com.microsoft.azure.graphrbac.GraphErrorException; +import com.microsoft.azure.graphrbac.GroupAddMemberParameters; +import com.microsoft.azure.graphrbac.GroupCreateParameters; +import com.microsoft.azure.graphrbac.GroupGetMemberGroupsParameters; +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; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.Path; +import retrofit2.http.POST; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Groups. + */ +public class GroupsInner { + /** The Retrofit service to perform REST calls. */ + private GroupsService service; + /** The service client containing this operation class. */ + private GraphRbacManagementClientImpl client; + + /** + * Initializes an instance of GroupsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public GroupsInner(Retrofit retrofit, GraphRbacManagementClientImpl client) { + this.service = retrofit.create(GroupsService.class); + this.client = client; + } + + /** + * The interface defining all the services for Groups to be + * used by Retrofit to perform actually REST calls. + */ + interface GroupsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.graphrbac.Groups isMemberOf" }) + @POST("{tenantID}/isMemberOf") + Observable> isMemberOf(@Path("tenantID") String tenantID, @Body CheckGroupMembershipParameters parameters, @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.graphrbac.Groups removeMember" }) + @HTTP(path = "{tenantID}/groups/{groupObjectId}/$links/members/{memberObjectId}", method = "DELETE", hasBody = true) + Observable> removeMember(@Path("groupObjectId") String groupObjectId, @Path("memberObjectId") String memberObjectId, @Path("tenantID") String tenantID, @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.graphrbac.Groups addMember" }) + @POST("{tenantID}/groups/{groupObjectId}/$links/members") + Observable> addMember(@Path("groupObjectId") String groupObjectId, @Path("tenantID") String tenantID, @Body GroupAddMemberParameters parameters, @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.graphrbac.Groups create" }) + @POST("{tenantID}/groups") + Observable> create(@Path("tenantID") String tenantID, @Body GroupCreateParameters parameters, @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.graphrbac.Groups list" }) + @GET("{tenantID}/groups") + Observable> list(@Path("tenantID") String tenantID, @Query("$filter") String filter, @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.graphrbac.Groups getGroupMembers" }) + @GET("{tenantID}/groups/{objectId}/members") + Observable> getGroupMembers(@Path("objectId") String objectId, @Path("tenantID") String tenantID, @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.graphrbac.Groups get" }) + @GET("{tenantID}/groups/{objectId}") + Observable> get(@Path("objectId") String objectId, @Path("tenantID") String tenantID, @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.graphrbac.Groups delete" }) + @HTTP(path = "{tenantID}/groups/{objectId}", method = "DELETE", hasBody = true) + Observable> delete(@Path("objectId") String objectId, @Path("tenantID") String tenantID, @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.graphrbac.Groups getMemberGroups" }) + @POST("{tenantID}/groups/{objectId}/getMemberGroups") + Observable> getMemberGroups(@Path("objectId") String objectId, @Path("tenantID") String tenantID, @Body GroupGetMemberGroupsParameters parameters, @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.graphrbac.Groups listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @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.graphrbac.Groups getGroupMembersNext" }) + @GET + Observable> getGroupMembersNext(@Url String nextUrl, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Checks whether the specified user, group, contact, or service principal is a direct or transitive member of the specified group. + * + * @param parameters The check group membership parameters. + * @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 CheckGroupMembershipResultInner object if successful. + */ + public CheckGroupMembershipResultInner isMemberOf(CheckGroupMembershipParameters parameters) { + return isMemberOfWithServiceResponseAsync(parameters).toBlocking().single().body(); + } + + /** + * Checks whether the specified user, group, contact, or service principal is a direct or transitive member of the specified group. + * + * @param parameters The check group membership parameters. + * @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 isMemberOfAsync(CheckGroupMembershipParameters parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(isMemberOfWithServiceResponseAsync(parameters), serviceCallback); + } + + /** + * Checks whether the specified user, group, contact, or service principal is a direct or transitive member of the specified group. + * + * @param parameters The check group membership parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CheckGroupMembershipResultInner object + */ + public Observable isMemberOfAsync(CheckGroupMembershipParameters parameters) { + return isMemberOfWithServiceResponseAsync(parameters).map(new Func1, CheckGroupMembershipResultInner>() { + @Override + public CheckGroupMembershipResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Checks whether the specified user, group, contact, or service principal is a direct or transitive member of the specified group. + * + * @param parameters The check group membership parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CheckGroupMembershipResultInner object + */ + public Observable> isMemberOfWithServiceResponseAsync(CheckGroupMembershipParameters parameters) { + if (this.client.tenantID() == null) { + throw new IllegalArgumentException("Parameter this.client.tenantID() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + return service.isMemberOf(this.client.tenantID(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = isMemberOfDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse isMemberOfDelegate(Response response) throws GraphErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(GraphErrorException.class) + .build(response); + } + + /** + * Remove a member from a group. + * + * @param groupObjectId The object ID of the group from which to remove the member. + * @param memberObjectId Member object id + * @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 + */ + public void removeMember(String groupObjectId, String memberObjectId) { + removeMemberWithServiceResponseAsync(groupObjectId, memberObjectId).toBlocking().single().body(); + } + + /** + * Remove a member from a group. + * + * @param groupObjectId The object ID of the group from which to remove the member. + * @param memberObjectId Member object 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 removeMemberAsync(String groupObjectId, String memberObjectId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(removeMemberWithServiceResponseAsync(groupObjectId, memberObjectId), serviceCallback); + } + + /** + * Remove a member from a group. + * + * @param groupObjectId The object ID of the group from which to remove the member. + * @param memberObjectId Member object id + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable removeMemberAsync(String groupObjectId, String memberObjectId) { + return removeMemberWithServiceResponseAsync(groupObjectId, memberObjectId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Remove a member from a group. + * + * @param groupObjectId The object ID of the group from which to remove the member. + * @param memberObjectId Member object id + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> removeMemberWithServiceResponseAsync(String groupObjectId, String memberObjectId) { + if (groupObjectId == null) { + throw new IllegalArgumentException("Parameter groupObjectId is required and cannot be null."); + } + if (memberObjectId == null) { + throw new IllegalArgumentException("Parameter memberObjectId is required and cannot be null."); + } + if (this.client.tenantID() == null) { + throw new IllegalArgumentException("Parameter this.client.tenantID() 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.removeMember(groupObjectId, memberObjectId, this.client.tenantID(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = removeMemberDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse removeMemberDelegate(Response response) throws GraphErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(204, new TypeToken() { }.getType()) + .registerError(GraphErrorException.class) + .build(response); + } + + /** + * Add a member to a group. + * + * @param groupObjectId The object ID of the group to which to add the member. + * @param parameters The URL of the member object, such as https://graph.windows.net/0b1f9851-1bf0-433f-aec3-cb9272f093dc/directoryObjects/f260bbc4-c254-447b-94cf-293b5ec434dd. + * @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 + */ + public void addMember(String groupObjectId, GroupAddMemberParameters parameters) { + addMemberWithServiceResponseAsync(groupObjectId, parameters).toBlocking().single().body(); + } + + /** + * Add a member to a group. + * + * @param groupObjectId The object ID of the group to which to add the member. + * @param parameters The URL of the member object, such as https://graph.windows.net/0b1f9851-1bf0-433f-aec3-cb9272f093dc/directoryObjects/f260bbc4-c254-447b-94cf-293b5ec434dd. + * @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 addMemberAsync(String groupObjectId, GroupAddMemberParameters parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(addMemberWithServiceResponseAsync(groupObjectId, parameters), serviceCallback); + } + + /** + * Add a member to a group. + * + * @param groupObjectId The object ID of the group to which to add the member. + * @param parameters The URL of the member object, such as https://graph.windows.net/0b1f9851-1bf0-433f-aec3-cb9272f093dc/directoryObjects/f260bbc4-c254-447b-94cf-293b5ec434dd. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable addMemberAsync(String groupObjectId, GroupAddMemberParameters parameters) { + return addMemberWithServiceResponseAsync(groupObjectId, parameters).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Add a member to a group. + * + * @param groupObjectId The object ID of the group to which to add the member. + * @param parameters The URL of the member object, such as https://graph.windows.net/0b1f9851-1bf0-433f-aec3-cb9272f093dc/directoryObjects/f260bbc4-c254-447b-94cf-293b5ec434dd. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> addMemberWithServiceResponseAsync(String groupObjectId, GroupAddMemberParameters parameters) { + if (groupObjectId == null) { + throw new IllegalArgumentException("Parameter groupObjectId is required and cannot be null."); + } + if (this.client.tenantID() == null) { + throw new IllegalArgumentException("Parameter this.client.tenantID() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + return service.addMember(groupObjectId, this.client.tenantID(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = addMemberDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse addMemberDelegate(Response response) throws GraphErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(204, new TypeToken() { }.getType()) + .registerError(GraphErrorException.class) + .build(response); + } + + /** + * Create a group in the directory. + * + * @param parameters The parameters for the group to create. + * @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 ADGroupInner object if successful. + */ + public ADGroupInner create(GroupCreateParameters parameters) { + return createWithServiceResponseAsync(parameters).toBlocking().single().body(); + } + + /** + * Create a group in the directory. + * + * @param parameters The parameters for the group to create. + * @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 createAsync(GroupCreateParameters parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createWithServiceResponseAsync(parameters), serviceCallback); + } + + /** + * Create a group in the directory. + * + * @param parameters The parameters for the group to create. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ADGroupInner object + */ + public Observable createAsync(GroupCreateParameters parameters) { + return createWithServiceResponseAsync(parameters).map(new Func1, ADGroupInner>() { + @Override + public ADGroupInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create a group in the directory. + * + * @param parameters The parameters for the group to create. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ADGroupInner object + */ + public Observable> createWithServiceResponseAsync(GroupCreateParameters parameters) { + if (this.client.tenantID() == null) { + throw new IllegalArgumentException("Parameter this.client.tenantID() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + return service.create(this.client.tenantID(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createDelegate(Response response) throws GraphErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(201, new TypeToken() { }.getType()) + .registerError(GraphErrorException.class) + .build(response); + } + + /** + * Gets list of groups for 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 PagedList<ADGroupInner> object if successful. + */ + public PagedList list() { + ServiceResponse> response = listSinglePageAsync().toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextLink) { + return listNextSinglePageAsync(nextLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets list of groups for 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> listAsync(final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(), + new Func1>>>() { + @Override + public Observable>> call(String nextLink) { + return listNextSinglePageAsync(nextLink); + } + }, + serviceCallback); + } + + /** + * Gets list of groups for the current tenant. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ADGroupInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets list of groups for the current tenant. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ADGroupInner> object + */ + public Observable>> listWithServiceResponseAsync() { + return listSinglePageAsync() + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextLink = page.body().nextPageLink(); + if (nextLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextLink)); + } + }); + } + + /** + * Gets list of groups for the current tenant. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ADGroupInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync() { + if (this.client.tenantID() == null) { + throw new IllegalArgumentException("Parameter this.client.tenantID() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String filter = null; + return service.list(this.client.tenantID(), filter, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Gets list of groups for the current tenant. + * + * @param filter The filter to apply to the operation. + * @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 PagedList<ADGroupInner> object if successful. + */ + public PagedList list(final String filter) { + ServiceResponse> response = listSinglePageAsync(filter).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextLink) { + return listNextSinglePageAsync(nextLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets list of groups for the current tenant. + * + * @param filter The filter to apply to the 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> listAsync(final String filter, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(filter), + new Func1>>>() { + @Override + public Observable>> call(String nextLink) { + return listNextSinglePageAsync(nextLink); + } + }, + serviceCallback); + } + + /** + * Gets list of groups for the current tenant. + * + * @param filter The filter to apply to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ADGroupInner> object + */ + public Observable> listAsync(final String filter) { + return listWithServiceResponseAsync(filter) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets list of groups for the current tenant. + * + * @param filter The filter to apply to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ADGroupInner> object + */ + public Observable>> listWithServiceResponseAsync(final String filter) { + return listSinglePageAsync(filter) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextLink = page.body().nextPageLink(); + if (nextLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextLink)); + } + }); + } + + /** + * Gets list of groups for the current tenant. + * + ServiceResponse> * @param filter The filter to apply to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ADGroupInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final String filter) { + if (this.client.tenantID() == null) { + throw new IllegalArgumentException("Parameter this.client.tenantID() 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.list(this.client.tenantID(), filter, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws GraphErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., GraphErrorException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(GraphErrorException.class) + .build(response); + } + + /** + * Gets the members of a group. + * + * @param objectId The object ID of the group whose members should be retrieved. + * @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 PagedList<AADObjectInner> object if successful. + */ + public PagedList getGroupMembers(final String objectId) { + ServiceResponse> response = getGroupMembersSinglePageAsync(objectId).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextLink) { + return getGroupMembersNextSinglePageAsync(nextLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets the members of a group. + * + * @param objectId The object ID of the group whose members should be retrieved. + * @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> getGroupMembersAsync(final String objectId, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + getGroupMembersSinglePageAsync(objectId), + new Func1>>>() { + @Override + public Observable>> call(String nextLink) { + return getGroupMembersNextSinglePageAsync(nextLink); + } + }, + serviceCallback); + } + + /** + * Gets the members of a group. + * + * @param objectId The object ID of the group whose members should be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<AADObjectInner> object + */ + public Observable> getGroupMembersAsync(final String objectId) { + return getGroupMembersWithServiceResponseAsync(objectId) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets the members of a group. + * + * @param objectId The object ID of the group whose members should be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<AADObjectInner> object + */ + public Observable>> getGroupMembersWithServiceResponseAsync(final String objectId) { + return getGroupMembersSinglePageAsync(objectId) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextLink = page.body().nextPageLink(); + if (nextLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(getGroupMembersNextWithServiceResponseAsync(nextLink)); + } + }); + } + + /** + * Gets the members of a group. + * + ServiceResponse> * @param objectId The object ID of the group whose members should be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<AADObjectInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> getGroupMembersSinglePageAsync(final String objectId) { + if (objectId == null) { + throw new IllegalArgumentException("Parameter objectId is required and cannot be null."); + } + if (this.client.tenantID() == null) { + throw new IllegalArgumentException("Parameter this.client.tenantID() 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.getGroupMembers(objectId, this.client.tenantID(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = getGroupMembersDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> getGroupMembersDelegate(Response response) throws GraphErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., GraphErrorException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(GraphErrorException.class) + .build(response); + } + + /** + * Gets group information from the directory. + * + * @param objectId The object ID of the user for which to get group information. + * @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 ADGroupInner object if successful. + */ + public ADGroupInner get(String objectId) { + return getWithServiceResponseAsync(objectId).toBlocking().single().body(); + } + + /** + * Gets group information from the directory. + * + * @param objectId The object ID of the user for which to get group information. + * @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 objectId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(objectId), serviceCallback); + } + + /** + * Gets group information from the directory. + * + * @param objectId The object ID of the user for which to get group information. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ADGroupInner object + */ + public Observable getAsync(String objectId) { + return getWithServiceResponseAsync(objectId).map(new Func1, ADGroupInner>() { + @Override + public ADGroupInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets group information from the directory. + * + * @param objectId The object ID of the user for which to get group information. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ADGroupInner object + */ + public Observable> getWithServiceResponseAsync(String objectId) { + if (objectId == null) { + throw new IllegalArgumentException("Parameter objectId is required and cannot be null."); + } + if (this.client.tenantID() == null) { + throw new IllegalArgumentException("Parameter this.client.tenantID() 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(objectId, this.client.tenantID(), 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 GraphErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(GraphErrorException.class) + .build(response); + } + + /** + * Delete a group from the directory. + * + * @param objectId The object ID of the group to delete. + * @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 + */ + public void delete(String objectId) { + deleteWithServiceResponseAsync(objectId).toBlocking().single().body(); + } + + /** + * Delete a group from the directory. + * + * @param objectId The object ID of the group to delete. + * @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 deleteAsync(String objectId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(objectId), serviceCallback); + } + + /** + * Delete a group from the directory. + * + * @param objectId The object ID of the group to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String objectId) { + return deleteWithServiceResponseAsync(objectId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Delete a group from the directory. + * + * @param objectId The object ID of the group to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String objectId) { + if (objectId == null) { + throw new IllegalArgumentException("Parameter objectId is required and cannot be null."); + } + if (this.client.tenantID() == null) { + throw new IllegalArgumentException("Parameter this.client.tenantID() 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.delete(objectId, this.client.tenantID(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(Response response) throws GraphErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(204, new TypeToken() { }.getType()) + .registerError(GraphErrorException.class) + .build(response); + } + + /** + * Gets a collection of object IDs of groups of which the specified group is a member. + * + * @param objectId The object ID of the group for which to get group membership. + * @param parameters Group filtering parameters. + * @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 List<String> object if successful. + */ + public List getMemberGroups(String objectId, GroupGetMemberGroupsParameters parameters) { + return getMemberGroupsWithServiceResponseAsync(objectId, parameters).toBlocking().single().body(); + } + + /** + * Gets a collection of object IDs of groups of which the specified group is a member. + * + * @param objectId The object ID of the group for which to get group membership. + * @param parameters Group filtering parameters. + * @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> getMemberGroupsAsync(String objectId, GroupGetMemberGroupsParameters parameters, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(getMemberGroupsWithServiceResponseAsync(objectId, parameters), serviceCallback); + } + + /** + * Gets a collection of object IDs of groups of which the specified group is a member. + * + * @param objectId The object ID of the group for which to get group membership. + * @param parameters Group filtering parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<String> object + */ + public Observable> getMemberGroupsAsync(String objectId, GroupGetMemberGroupsParameters parameters) { + return getMemberGroupsWithServiceResponseAsync(objectId, parameters).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a collection of object IDs of groups of which the specified group is a member. + * + * @param objectId The object ID of the group for which to get group membership. + * @param parameters Group filtering parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<String> object + */ + public Observable>> getMemberGroupsWithServiceResponseAsync(String objectId, GroupGetMemberGroupsParameters parameters) { + if (objectId == null) { + throw new IllegalArgumentException("Parameter objectId is required and cannot be null."); + } + if (this.client.tenantID() == null) { + throw new IllegalArgumentException("Parameter this.client.tenantID() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + return service.getMemberGroups(objectId, this.client.tenantID(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = getMemberGroupsDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> getMemberGroupsDelegate(Response response) throws GraphErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., GraphErrorException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(GraphErrorException.class) + .build(response); + } + + /** + * Gets a list of groups for the current tenant. + * + * @param nextLink Next link for the list operation. + * @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 PagedList<ADGroupInner> object if successful. + */ + public PagedList listNext(final String nextLink) { + ServiceResponse> response = listNextSinglePageAsync(nextLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextLink) { + return listNextSinglePageAsync(nextLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets a list of groups for the current tenant. + * + * @param nextLink Next link for the 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> listNextAsync(final String nextLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextLink), + new Func1>>>() { + @Override + public Observable>> call(String nextLink) { + return listNextSinglePageAsync(nextLink); + } + }, + serviceCallback); + } + + /** + * Gets a list of groups for the current tenant. + * + * @param nextLink Next link for the list operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ADGroupInner> object + */ + public Observable> listNextAsync(final String nextLink) { + return listNextWithServiceResponseAsync(nextLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a list of groups for the current tenant. + * + * @param nextLink Next link for the list operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ADGroupInner> object + */ + public Observable>> listNextWithServiceResponseAsync(final String nextLink) { + return listNextSinglePageAsync(nextLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextLink = page.body().nextPageLink(); + if (nextLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextLink)); + } + }); + } + + /** + * Gets a list of groups for the current tenant. + * + ServiceResponse> * @param nextLink Next link for the list operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ADGroupInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listNextSinglePageAsync(final String nextLink) { + if (nextLink == null) { + throw new IllegalArgumentException("Parameter nextLink is required and cannot be null."); + } + if (this.client.tenantID() == null) { + throw new IllegalArgumentException("Parameter this.client.tenantID() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + String nextUrl = String.format("%s/%s", this.client.tenantID(), nextLink); + return service.listNext(nextUrl, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listNextDelegate(Response response) throws GraphErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., GraphErrorException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(GraphErrorException.class) + .build(response); + } + + /** + * Gets the members of a group. + * + * @param nextLink Next link for the list operation. + * @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 PagedList<AADObjectInner> object if successful. + */ + public PagedList getGroupMembersNext(final String nextLink) { + ServiceResponse> response = getGroupMembersNextSinglePageAsync(nextLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextLink) { + return getGroupMembersNextSinglePageAsync(nextLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets the members of a group. + * + * @param nextLink Next link for the 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> getGroupMembersNextAsync(final String nextLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + getGroupMembersNextSinglePageAsync(nextLink), + new Func1>>>() { + @Override + public Observable>> call(String nextLink) { + return getGroupMembersNextSinglePageAsync(nextLink); + } + }, + serviceCallback); + } + + /** + * Gets the members of a group. + * + * @param nextLink Next link for the list operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<AADObjectInner> object + */ + public Observable> getGroupMembersNextAsync(final String nextLink) { + return getGroupMembersNextWithServiceResponseAsync(nextLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets the members of a group. + * + * @param nextLink Next link for the list operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<AADObjectInner> object + */ + public Observable>> getGroupMembersNextWithServiceResponseAsync(final String nextLink) { + return getGroupMembersNextSinglePageAsync(nextLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextLink = page.body().nextPageLink(); + if (nextLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(getGroupMembersNextWithServiceResponseAsync(nextLink)); + } + }); + } + + /** + * Gets the members of a group. + * + ServiceResponse> * @param nextLink Next link for the list operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<AADObjectInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> getGroupMembersNextSinglePageAsync(final String nextLink) { + if (nextLink == null) { + throw new IllegalArgumentException("Parameter nextLink is required and cannot be null."); + } + if (this.client.tenantID() == null) { + throw new IllegalArgumentException("Parameter this.client.tenantID() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + String nextUrl = String.format("%s/%s", this.client.tenantID(), nextLink); + return service.getGroupMembersNext(nextUrl, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = getGroupMembersNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> getGroupMembersNextDelegate(Response response) throws GraphErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., GraphErrorException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(GraphErrorException.class) + .build(response); + } + +} diff --git a/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/KeyCredentialInner.java b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/KeyCredentialInner.java new file mode 100644 index 000000000000..74d72b5c8ab9 --- /dev/null +++ b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/KeyCredentialInner.java @@ -0,0 +1,227 @@ +/** + * 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 java.util.Map; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Active Directory Key Credential information. + */ +public class KeyCredentialInner { + /** + * Unmatched properties from the message are deserialized this collection. + */ + @JsonProperty(value = "") + private Map additionalProperties; + + /** + * Start date. + */ + @JsonProperty(value = "startDate") + private DateTime startDate; + + /** + * End date. + */ + @JsonProperty(value = "endDate") + private DateTime endDate; + + /** + * Key value. + */ + @JsonProperty(value = "value") + private String value; + + /** + * Key ID. + */ + @JsonProperty(value = "keyId") + private String keyId; + + /** + * Usage. Acceptable values are 'Verify' and 'Sign'. + */ + @JsonProperty(value = "usage") + private String usage; + + /** + * Type. Acceptable values are 'AsymmetricX509Cert' and 'Symmetric'. + */ + @JsonProperty(value = "type") + private String type; + + /** + * Custom Key Identifier. + */ + @JsonProperty(value = "customKeyIdentifier") + private byte[] customKeyIdentifier; + + /** + * Get unmatched properties from the message are deserialized this collection. + * + * @return the additionalProperties value + */ + public Map additionalProperties() { + return this.additionalProperties; + } + + /** + * Set unmatched properties from the message are deserialized this collection. + * + * @param additionalProperties the additionalProperties value to set + * @return the KeyCredentialInner object itself. + */ + public KeyCredentialInner withAdditionalProperties(Map additionalProperties) { + this.additionalProperties = additionalProperties; + return this; + } + + /** + * Get start date. + * + * @return the startDate value + */ + public DateTime startDate() { + return this.startDate; + } + + /** + * Set start date. + * + * @param startDate the startDate value to set + * @return the KeyCredentialInner object itself. + */ + public KeyCredentialInner withStartDate(DateTime startDate) { + this.startDate = startDate; + return this; + } + + /** + * Get end date. + * + * @return the endDate value + */ + public DateTime endDate() { + return this.endDate; + } + + /** + * Set end date. + * + * @param endDate the endDate value to set + * @return the KeyCredentialInner object itself. + */ + public KeyCredentialInner withEndDate(DateTime endDate) { + this.endDate = endDate; + return this; + } + + /** + * Get key value. + * + * @return the value value + */ + public String value() { + return this.value; + } + + /** + * Set key value. + * + * @param value the value value to set + * @return the KeyCredentialInner object itself. + */ + public KeyCredentialInner withValue(String value) { + this.value = value; + return this; + } + + /** + * Get key ID. + * + * @return the keyId value + */ + public String keyId() { + return this.keyId; + } + + /** + * Set key ID. + * + * @param keyId the keyId value to set + * @return the KeyCredentialInner object itself. + */ + public KeyCredentialInner withKeyId(String keyId) { + this.keyId = keyId; + return this; + } + + /** + * Get usage. Acceptable values are 'Verify' and 'Sign'. + * + * @return the usage value + */ + public String usage() { + return this.usage; + } + + /** + * Set usage. Acceptable values are 'Verify' and 'Sign'. + * + * @param usage the usage value to set + * @return the KeyCredentialInner object itself. + */ + public KeyCredentialInner withUsage(String usage) { + this.usage = usage; + return this; + } + + /** + * Get type. Acceptable values are 'AsymmetricX509Cert' and 'Symmetric'. + * + * @return the type value + */ + public String type() { + return this.type; + } + + /** + * Set type. Acceptable values are 'AsymmetricX509Cert' and 'Symmetric'. + * + * @param type the type value to set + * @return the KeyCredentialInner object itself. + */ + public KeyCredentialInner withType(String type) { + this.type = type; + return this; + } + + /** + * Get custom Key Identifier. + * + * @return the customKeyIdentifier value + */ + public byte[] customKeyIdentifier() { + return this.customKeyIdentifier; + } + + /** + * Set custom Key Identifier. + * + * @param customKeyIdentifier the customKeyIdentifier value to set + * @return the KeyCredentialInner object itself. + */ + public KeyCredentialInner withCustomKeyIdentifier(byte[] customKeyIdentifier) { + this.customKeyIdentifier = customKeyIdentifier; + return this; + } + +} diff --git a/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/OAuth2Inner.java b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/OAuth2Inner.java new file mode 100644 index 000000000000..675bc29f5b0d --- /dev/null +++ b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/OAuth2Inner.java @@ -0,0 +1,225 @@ +/** + * 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; + +/** + * The OAuth2Inner model. + */ +public class OAuth2Inner { + /** + * Microsoft.DirectoryServices.OAuth2PermissionGrant. + */ + @JsonProperty(value = "odata\\.type") + private String odatatype; + + /** + * The objectId of the Service Principal associated with the app. + */ + @JsonProperty(value = "clientId") + private String clientId; + + /** + * Typically set to AllPrincipals. + */ + @JsonProperty(value = "consentType") + private String consentType; + + /** + * Set to null if AllPrincipals is set. + */ + @JsonProperty(value = "principalId") + private Object principalId; + + /** + * Service Principal Id of the resource you want to grant. + */ + @JsonProperty(value = "resourceId") + private String resourceId; + + /** + * Typically set to user_impersonation. + */ + @JsonProperty(value = "scope") + private String scope; + + /** + * Start time for TTL. + */ + @JsonProperty(value = "startTime") + private String startTime; + + /** + * Expiry time for TTL. + */ + @JsonProperty(value = "expiryTime") + private String expiryTime; + + /** + * Get microsoft.DirectoryServices.OAuth2PermissionGrant. + * + * @return the odatatype value + */ + public String odatatype() { + return this.odatatype; + } + + /** + * Set microsoft.DirectoryServices.OAuth2PermissionGrant. + * + * @param odatatype the odatatype value to set + * @return the OAuth2Inner object itself. + */ + public OAuth2Inner withOdatatype(String odatatype) { + this.odatatype = odatatype; + return this; + } + + /** + * Get the objectId of the Service Principal associated with the app. + * + * @return the clientId value + */ + public String clientId() { + return this.clientId; + } + + /** + * Set the objectId of the Service Principal associated with the app. + * + * @param clientId the clientId value to set + * @return the OAuth2Inner object itself. + */ + public OAuth2Inner withClientId(String clientId) { + this.clientId = clientId; + return this; + } + + /** + * Get typically set to AllPrincipals. + * + * @return the consentType value + */ + public String consentType() { + return this.consentType; + } + + /** + * Set typically set to AllPrincipals. + * + * @param consentType the consentType value to set + * @return the OAuth2Inner object itself. + */ + public OAuth2Inner withConsentType(String consentType) { + this.consentType = consentType; + return this; + } + + /** + * Get set to null if AllPrincipals is set. + * + * @return the principalId value + */ + public Object principalId() { + return this.principalId; + } + + /** + * Set set to null if AllPrincipals is set. + * + * @param principalId the principalId value to set + * @return the OAuth2Inner object itself. + */ + public OAuth2Inner withPrincipalId(Object principalId) { + this.principalId = principalId; + return this; + } + + /** + * Get service Principal Id of the resource you want to grant. + * + * @return the resourceId value + */ + public String resourceId() { + return this.resourceId; + } + + /** + * Set service Principal Id of the resource you want to grant. + * + * @param resourceId the resourceId value to set + * @return the OAuth2Inner object itself. + */ + public OAuth2Inner withResourceId(String resourceId) { + this.resourceId = resourceId; + return this; + } + + /** + * Get typically set to user_impersonation. + * + * @return the scope value + */ + public String scope() { + return this.scope; + } + + /** + * Set typically set to user_impersonation. + * + * @param scope the scope value to set + * @return the OAuth2Inner object itself. + */ + public OAuth2Inner withScope(String scope) { + this.scope = scope; + return this; + } + + /** + * Get start time for TTL. + * + * @return the startTime value + */ + public String startTime() { + return this.startTime; + } + + /** + * Set start time for TTL. + * + * @param startTime the startTime value to set + * @return the OAuth2Inner object itself. + */ + public OAuth2Inner withStartTime(String startTime) { + this.startTime = startTime; + return this; + } + + /** + * Get expiry time for TTL. + * + * @return the expiryTime value + */ + public String expiryTime() { + return this.expiryTime; + } + + /** + * Set expiry time for TTL. + * + * @param expiryTime the expiryTime value to set + * @return the OAuth2Inner object itself. + */ + public OAuth2Inner withExpiryTime(String expiryTime) { + this.expiryTime = expiryTime; + return this; + } + +} diff --git a/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/OAuth2sInner.java b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/OAuth2sInner.java new file mode 100644 index 000000000000..78dcc195e9cc --- /dev/null +++ b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/OAuth2sInner.java @@ -0,0 +1,352 @@ +/** + * 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.CloudException; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.POST; +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 OAuth2s. + */ +public class OAuth2sInner { + /** The Retrofit service to perform REST calls. */ + private OAuth2sService service; + /** The service client containing this operation class. */ + private GraphRbacManagementClientImpl client; + + /** + * Initializes an instance of OAuth2sInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public OAuth2sInner(Retrofit retrofit, GraphRbacManagementClientImpl client) { + this.service = retrofit.create(OAuth2sService.class); + this.client = client; + } + + /** + * The interface defining all the services for OAuth2s to be + * used by Retrofit to perform actually REST calls. + */ + interface OAuth2sService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.graphrbac.OAuth2s get" }) + @GET("{tenantID}/oauth2PermissionGrants") + Observable> get(@Path("tenantID") String tenantID, @Query("$filter") String filter, @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.graphrbac.OAuth2s post" }) + @POST("{tenantID}/oauth2PermissionGrants") + Observable> post(@Path("tenantID") String tenantID, @Body PermissionsInner body, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Queries OAuth2 permissions for the relevant SP ObjectId of an app. + * + * @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 PermissionsInner object if successful. + */ + public PermissionsInner get() { + return getWithServiceResponseAsync().toBlocking().single().body(); + } + + /** + * Queries OAuth2 permissions for the relevant SP ObjectId of an app. + * + * @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(final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(), serviceCallback); + } + + /** + * Queries OAuth2 permissions for the relevant SP ObjectId of an app. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PermissionsInner object + */ + public Observable getAsync() { + return getWithServiceResponseAsync().map(new Func1, PermissionsInner>() { + @Override + public PermissionsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Queries OAuth2 permissions for the relevant SP ObjectId of an app. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PermissionsInner object + */ + public Observable> getWithServiceResponseAsync() { + if (this.client.tenantID() == null) { + throw new IllegalArgumentException("Parameter this.client.tenantID() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String filter = null; + return service.get(this.client.tenantID(), filter, 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); + } + } + }); + } + + /** + * Queries OAuth2 permissions for the relevant SP ObjectId of an app. + * + * @param filter This is the Service Principal ObjectId associated with the app + * @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 PermissionsInner object if successful. + */ + public PermissionsInner get(String filter) { + return getWithServiceResponseAsync(filter).toBlocking().single().body(); + } + + /** + * Queries OAuth2 permissions for the relevant SP ObjectId of an app. + * + * @param filter This is the Service Principal ObjectId associated with the app + * @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 filter, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(filter), serviceCallback); + } + + /** + * Queries OAuth2 permissions for the relevant SP ObjectId of an app. + * + * @param filter This is the Service Principal ObjectId associated with the app + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PermissionsInner object + */ + public Observable getAsync(String filter) { + return getWithServiceResponseAsync(filter).map(new Func1, PermissionsInner>() { + @Override + public PermissionsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Queries OAuth2 permissions for the relevant SP ObjectId of an app. + * + * @param filter This is the Service Principal ObjectId associated with the app + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PermissionsInner object + */ + public Observable> getWithServiceResponseAsync(String filter) { + if (this.client.tenantID() == null) { + throw new IllegalArgumentException("Parameter this.client.tenantID() 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(), filter, 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); + } + + /** + * Grants OAuth2 permissions for the relevant resource Ids of an app. + * + * @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 PermissionsInner object if successful. + */ + public PermissionsInner post() { + return postWithServiceResponseAsync().toBlocking().single().body(); + } + + /** + * Grants OAuth2 permissions for the relevant resource Ids of an app. + * + * @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 postAsync(final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(postWithServiceResponseAsync(), serviceCallback); + } + + /** + * Grants OAuth2 permissions for the relevant resource Ids of an app. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PermissionsInner object + */ + public Observable postAsync() { + return postWithServiceResponseAsync().map(new Func1, PermissionsInner>() { + @Override + public PermissionsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Grants OAuth2 permissions for the relevant resource Ids of an app. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PermissionsInner object + */ + public Observable> postWithServiceResponseAsync() { + if (this.client.tenantID() == null) { + throw new IllegalArgumentException("Parameter this.client.tenantID() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final PermissionsInner body = null; + return service.post(this.client.tenantID(), body, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = postDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Grants OAuth2 permissions for the relevant resource Ids of an app. + * + * @param body The relevant app Service Principal Object Id and the Service Principal Objecit Id you want to grant. + * @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 PermissionsInner object if successful. + */ + public PermissionsInner post(PermissionsInner body) { + return postWithServiceResponseAsync(body).toBlocking().single().body(); + } + + /** + * Grants OAuth2 permissions for the relevant resource Ids of an app. + * + * @param body The relevant app Service Principal Object Id and the Service Principal Objecit Id you want to grant. + * @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 postAsync(PermissionsInner body, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(postWithServiceResponseAsync(body), serviceCallback); + } + + /** + * Grants OAuth2 permissions for the relevant resource Ids of an app. + * + * @param body The relevant app Service Principal Object Id and the Service Principal Objecit Id you want to grant. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PermissionsInner object + */ + public Observable postAsync(PermissionsInner body) { + return postWithServiceResponseAsync(body).map(new Func1, PermissionsInner>() { + @Override + public PermissionsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Grants OAuth2 permissions for the relevant resource Ids of an app. + * + * @param body The relevant app Service Principal Object Id and the Service Principal Objecit Id you want to grant. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PermissionsInner object + */ + public Observable> postWithServiceResponseAsync(PermissionsInner body) { + if (this.client.tenantID() == null) { + throw new IllegalArgumentException("Parameter this.client.tenantID() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(body); + return service.post(this.client.tenantID(), body, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = postDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse postDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(201, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/ObjectsInner.java b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/ObjectsInner.java new file mode 100644 index 000000000000..483cb3d3757f --- /dev/null +++ b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/ObjectsInner.java @@ -0,0 +1,384 @@ +/** + * 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.AzureServiceFuture; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.graphrbac.GetObjectsParameters; +import com.microsoft.azure.graphrbac.GraphErrorException; +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; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.POST; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Objects. + */ +public class ObjectsInner { + /** The Retrofit service to perform REST calls. */ + private ObjectsService service; + /** The service client containing this operation class. */ + private GraphRbacManagementClientImpl client; + + /** + * Initializes an instance of ObjectsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ObjectsInner(Retrofit retrofit, GraphRbacManagementClientImpl client) { + this.service = retrofit.create(ObjectsService.class); + this.client = client; + } + + /** + * The interface defining all the services for Objects to be + * used by Retrofit to perform actually REST calls. + */ + interface ObjectsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.graphrbac.Objects getCurrentUser" }) + @GET("{tenantID}/me") + Observable> getCurrentUser(@Path("tenantID") String tenantID, @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.graphrbac.Objects getObjectsByObjectIds" }) + @POST("{tenantID}/getObjectsByObjectIds") + Observable> getObjectsByObjectIds(@Path("tenantID") String tenantID, @Body GetObjectsParameters parameters, @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.graphrbac.Objects getObjectsByObjectIdsNext" }) + @GET + Observable> getObjectsByObjectIdsNext(@Url String nextUrl, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets the details for the currently logged-in user. + * + * @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 AADObjectInner object if successful. + */ + public AADObjectInner getCurrentUser() { + return getCurrentUserWithServiceResponseAsync().toBlocking().single().body(); + } + + /** + * Gets the details for the currently logged-in user. + * + * @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 getCurrentUserAsync(final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getCurrentUserWithServiceResponseAsync(), serviceCallback); + } + + /** + * Gets the details for the currently logged-in user. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AADObjectInner object + */ + public Observable getCurrentUserAsync() { + return getCurrentUserWithServiceResponseAsync().map(new Func1, AADObjectInner>() { + @Override + public AADObjectInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the details for the currently logged-in user. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AADObjectInner object + */ + public Observable> getCurrentUserWithServiceResponseAsync() { + if (this.client.tenantID() == null) { + throw new IllegalArgumentException("Parameter this.client.tenantID() 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.getCurrentUser(this.client.tenantID(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getCurrentUserDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getCurrentUserDelegate(Response response) throws GraphErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(GraphErrorException.class) + .build(response); + } + + /** + * Gets AD group membership for the specified AD object IDs. + * + * @param parameters Objects filtering parameters. + * @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<AADObjectInner> object if successful. + */ + public PagedList getObjectsByObjectIds(final GetObjectsParameters parameters) { + ServiceResponse> response = getObjectsByObjectIdsSinglePageAsync(parameters).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextLink) { + return getObjectsByObjectIdsNextSinglePageAsync(nextLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets AD group membership for the specified AD object IDs. + * + * @param parameters Objects filtering parameters. + * @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> getObjectsByObjectIdsAsync(final GetObjectsParameters parameters, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + getObjectsByObjectIdsSinglePageAsync(parameters), + new Func1>>>() { + @Override + public Observable>> call(String nextLink) { + return getObjectsByObjectIdsNextSinglePageAsync(nextLink); + } + }, + serviceCallback); + } + + /** + * Gets AD group membership for the specified AD object IDs. + * + * @param parameters Objects filtering parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<AADObjectInner> object + */ + public Observable> getObjectsByObjectIdsAsync(final GetObjectsParameters parameters) { + return getObjectsByObjectIdsWithServiceResponseAsync(parameters) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets AD group membership for the specified AD object IDs. + * + * @param parameters Objects filtering parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<AADObjectInner> object + */ + public Observable>> getObjectsByObjectIdsWithServiceResponseAsync(final GetObjectsParameters parameters) { + return getObjectsByObjectIdsSinglePageAsync(parameters) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextLink = page.body().nextPageLink(); + if (nextLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(getObjectsByObjectIdsNextWithServiceResponseAsync(nextLink)); + } + }); + } + + /** + * Gets AD group membership for the specified AD object IDs. + * + ServiceResponse> * @param parameters Objects filtering parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<AADObjectInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> getObjectsByObjectIdsSinglePageAsync(final GetObjectsParameters parameters) { + if (this.client.tenantID() == null) { + throw new IllegalArgumentException("Parameter this.client.tenantID() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + return service.getObjectsByObjectIds(this.client.tenantID(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = getObjectsByObjectIdsDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> getObjectsByObjectIdsDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets AD group membership for the specified AD object IDs. + * + * @param nextLink Next link for the 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<AADObjectInner> object if successful. + */ + public PagedList getObjectsByObjectIdsNext(final String nextLink) { + ServiceResponse> response = getObjectsByObjectIdsNextSinglePageAsync(nextLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextLink) { + return getObjectsByObjectIdsNextSinglePageAsync(nextLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets AD group membership for the specified AD object IDs. + * + * @param nextLink Next link for the 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> getObjectsByObjectIdsNextAsync(final String nextLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + getObjectsByObjectIdsNextSinglePageAsync(nextLink), + new Func1>>>() { + @Override + public Observable>> call(String nextLink) { + return getObjectsByObjectIdsNextSinglePageAsync(nextLink); + } + }, + serviceCallback); + } + + /** + * Gets AD group membership for the specified AD object IDs. + * + * @param nextLink Next link for the list operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<AADObjectInner> object + */ + public Observable> getObjectsByObjectIdsNextAsync(final String nextLink) { + return getObjectsByObjectIdsNextWithServiceResponseAsync(nextLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets AD group membership for the specified AD object IDs. + * + * @param nextLink Next link for the list operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<AADObjectInner> object + */ + public Observable>> getObjectsByObjectIdsNextWithServiceResponseAsync(final String nextLink) { + return getObjectsByObjectIdsNextSinglePageAsync(nextLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextLink = page.body().nextPageLink(); + if (nextLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(getObjectsByObjectIdsNextWithServiceResponseAsync(nextLink)); + } + }); + } + + /** + * Gets AD group membership for the specified AD object IDs. + * + ServiceResponse> * @param nextLink Next link for the list operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<AADObjectInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> getObjectsByObjectIdsNextSinglePageAsync(final String nextLink) { + if (nextLink == null) { + throw new IllegalArgumentException("Parameter nextLink is required and cannot be null."); + } + if (this.client.tenantID() == null) { + throw new IllegalArgumentException("Parameter this.client.tenantID() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + String nextUrl = String.format("%s/%s", this.client.tenantID(), nextLink); + return service.getObjectsByObjectIdsNext(nextUrl, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = getObjectsByObjectIdsNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> getObjectsByObjectIdsNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/PageImpl.java b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/PageImpl.java new file mode 100644 index 000000000000..2f05e837ff83 --- /dev/null +++ b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/PageImpl.java @@ -0,0 +1,75 @@ +/** + * 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; +import com.microsoft.azure.Page; +import java.util.List; + +/** + * An instance of this class defines a page of Azure resources and a link to + * get the next page of resources, if any. + * + * @param type of Azure resource + */ +public class PageImpl implements Page { + /** + * The link to the next page. + */ + @JsonProperty("odata.nextLink") + private String nextPageLink; + + /** + * The list of items. + */ + @JsonProperty("value") + private List items; + + /** + * Gets the link to the next page. + * + * @return the link to the next page. + */ + @Override + public String nextPageLink() { + return this.nextPageLink; + } + + /** + * Gets the list of items. + * + * @return the list of items in {@link List}. + */ + @Override + public List items() { + return items; + } + + /** + * Sets the link to the next page. + * + * @param nextPageLink the link to the next page. + * @return this Page object itself. + */ + public PageImpl setNextPageLink(String nextPageLink) { + this.nextPageLink = nextPageLink; + return this; + } + + /** + * Sets the list of items. + * + * @param items the list of items in {@link List}. + * @return this Page object itself. + */ + public PageImpl setItems(List items) { + this.items = items; + return this; + } +} diff --git a/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/PageImpl1.java b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/PageImpl1.java new file mode 100644 index 000000000000..645823a94852 --- /dev/null +++ b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/PageImpl1.java @@ -0,0 +1,75 @@ +/** + * 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; +import com.microsoft.azure.Page; +import java.util.List; + +/** + * An instance of this class defines a page of Azure resources and a link to + * get the next page of resources, if any. + * + * @param type of Azure resource + */ +public class PageImpl1 implements Page { + /** + * The link to the next page. + */ + @JsonProperty("") + private String nextPageLink; + + /** + * The list of items. + */ + @JsonProperty("value") + private List items; + + /** + * Gets the link to the next page. + * + * @return the link to the next page. + */ + @Override + public String nextPageLink() { + return this.nextPageLink; + } + + /** + * Gets the list of items. + * + * @return the list of items in {@link List}. + */ + @Override + public List items() { + return items; + } + + /** + * Sets the link to the next page. + * + * @param nextPageLink the link to the next page. + * @return this Page object itself. + */ + public PageImpl1 setNextPageLink(String nextPageLink) { + this.nextPageLink = nextPageLink; + return this; + } + + /** + * Sets the list of items. + * + * @param items the list of items in {@link List}. + * @return this Page object itself. + */ + public PageImpl1 setItems(List items) { + this.items = items; + return this; + } +} diff --git a/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/PasswordCredentialInner.java b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/PasswordCredentialInner.java new file mode 100644 index 000000000000..6d65afec9995 --- /dev/null +++ b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/PasswordCredentialInner.java @@ -0,0 +1,149 @@ +/** + * 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 java.util.Map; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Active Directory Password Credential information. + */ +public class PasswordCredentialInner { + /** + * Unmatched properties from the message are deserialized this collection. + */ + @JsonProperty(value = "") + private Map additionalProperties; + + /** + * Start date. + */ + @JsonProperty(value = "startDate") + private DateTime startDate; + + /** + * End date. + */ + @JsonProperty(value = "endDate") + private DateTime endDate; + + /** + * Key ID. + */ + @JsonProperty(value = "keyId") + private String keyId; + + /** + * Key value. + */ + @JsonProperty(value = "value") + private String value; + + /** + * Get unmatched properties from the message are deserialized this collection. + * + * @return the additionalProperties value + */ + public Map additionalProperties() { + return this.additionalProperties; + } + + /** + * Set unmatched properties from the message are deserialized this collection. + * + * @param additionalProperties the additionalProperties value to set + * @return the PasswordCredentialInner object itself. + */ + public PasswordCredentialInner withAdditionalProperties(Map additionalProperties) { + this.additionalProperties = additionalProperties; + return this; + } + + /** + * Get start date. + * + * @return the startDate value + */ + public DateTime startDate() { + return this.startDate; + } + + /** + * Set start date. + * + * @param startDate the startDate value to set + * @return the PasswordCredentialInner object itself. + */ + public PasswordCredentialInner withStartDate(DateTime startDate) { + this.startDate = startDate; + return this; + } + + /** + * Get end date. + * + * @return the endDate value + */ + public DateTime endDate() { + return this.endDate; + } + + /** + * Set end date. + * + * @param endDate the endDate value to set + * @return the PasswordCredentialInner object itself. + */ + public PasswordCredentialInner withEndDate(DateTime endDate) { + this.endDate = endDate; + return this; + } + + /** + * Get key ID. + * + * @return the keyId value + */ + public String keyId() { + return this.keyId; + } + + /** + * Set key ID. + * + * @param keyId the keyId value to set + * @return the PasswordCredentialInner object itself. + */ + public PasswordCredentialInner withKeyId(String keyId) { + this.keyId = keyId; + return this; + } + + /** + * Get key value. + * + * @return the value value + */ + public String value() { + return this.value; + } + + /** + * Set key value. + * + * @param value the value value to set + * @return the PasswordCredentialInner object itself. + */ + public PasswordCredentialInner withValue(String value) { + this.value = value; + return this; + } + +} diff --git a/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/PermissionsInner.java b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/PermissionsInner.java new file mode 100644 index 000000000000..5cdc17271148 --- /dev/null +++ b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/PermissionsInner.java @@ -0,0 +1,225 @@ +/** + * 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; + +/** + * The PermissionsInner model. + */ +public class PermissionsInner { + /** + * Microsoft.DirectoryServices.OAuth2PermissionGrant. + */ + @JsonProperty(value = "odata\\.type") + private String odatatype; + + /** + * The objectId of the Service Principal associated with the app. + */ + @JsonProperty(value = "clientId") + private String clientId; + + /** + * Typically set to AllPrincipals. + */ + @JsonProperty(value = "consentType") + private String consentType; + + /** + * Set to null if AllPrincipals is set. + */ + @JsonProperty(value = "principalId") + private Object principalId; + + /** + * Service Principal Id of the resource you want to grant. + */ + @JsonProperty(value = "resourceId") + private String resourceId; + + /** + * Typically set to user_impersonation. + */ + @JsonProperty(value = "scope") + private String scope; + + /** + * Start time for TTL. + */ + @JsonProperty(value = "startTime") + private String startTime; + + /** + * Expiry time for TTL. + */ + @JsonProperty(value = "expiryTime") + private String expiryTime; + + /** + * Get microsoft.DirectoryServices.OAuth2PermissionGrant. + * + * @return the odatatype value + */ + public String odatatype() { + return this.odatatype; + } + + /** + * Set microsoft.DirectoryServices.OAuth2PermissionGrant. + * + * @param odatatype the odatatype value to set + * @return the PermissionsInner object itself. + */ + public PermissionsInner withOdatatype(String odatatype) { + this.odatatype = odatatype; + return this; + } + + /** + * Get the objectId of the Service Principal associated with the app. + * + * @return the clientId value + */ + public String clientId() { + return this.clientId; + } + + /** + * Set the objectId of the Service Principal associated with the app. + * + * @param clientId the clientId value to set + * @return the PermissionsInner object itself. + */ + public PermissionsInner withClientId(String clientId) { + this.clientId = clientId; + return this; + } + + /** + * Get typically set to AllPrincipals. + * + * @return the consentType value + */ + public String consentType() { + return this.consentType; + } + + /** + * Set typically set to AllPrincipals. + * + * @param consentType the consentType value to set + * @return the PermissionsInner object itself. + */ + public PermissionsInner withConsentType(String consentType) { + this.consentType = consentType; + return this; + } + + /** + * Get set to null if AllPrincipals is set. + * + * @return the principalId value + */ + public Object principalId() { + return this.principalId; + } + + /** + * Set set to null if AllPrincipals is set. + * + * @param principalId the principalId value to set + * @return the PermissionsInner object itself. + */ + public PermissionsInner withPrincipalId(Object principalId) { + this.principalId = principalId; + return this; + } + + /** + * Get service Principal Id of the resource you want to grant. + * + * @return the resourceId value + */ + public String resourceId() { + return this.resourceId; + } + + /** + * Set service Principal Id of the resource you want to grant. + * + * @param resourceId the resourceId value to set + * @return the PermissionsInner object itself. + */ + public PermissionsInner withResourceId(String resourceId) { + this.resourceId = resourceId; + return this; + } + + /** + * Get typically set to user_impersonation. + * + * @return the scope value + */ + public String scope() { + return this.scope; + } + + /** + * Set typically set to user_impersonation. + * + * @param scope the scope value to set + * @return the PermissionsInner object itself. + */ + public PermissionsInner withScope(String scope) { + this.scope = scope; + return this; + } + + /** + * Get start time for TTL. + * + * @return the startTime value + */ + public String startTime() { + return this.startTime; + } + + /** + * Set start time for TTL. + * + * @param startTime the startTime value to set + * @return the PermissionsInner object itself. + */ + public PermissionsInner withStartTime(String startTime) { + this.startTime = startTime; + return this; + } + + /** + * Get expiry time for TTL. + * + * @return the expiryTime value + */ + public String expiryTime() { + return this.expiryTime; + } + + /** + * Set expiry time for TTL. + * + * @param expiryTime the expiryTime value to set + * @return the PermissionsInner object itself. + */ + public PermissionsInner withExpiryTime(String expiryTime) { + this.expiryTime = expiryTime; + return this; + } + +} diff --git a/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/ServicePrincipalInner.java b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/ServicePrincipalInner.java new file mode 100644 index 000000000000..8c8e5f9c7568 --- /dev/null +++ b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/ServicePrincipalInner.java @@ -0,0 +1,100 @@ +/** + * 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 java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * Active Directory service principal information. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "objectType") +@JsonTypeName("ServicePrincipal") +public class ServicePrincipalInner extends DirectoryObjectInner { + /** + * The display name of the service principal. + */ + @JsonProperty(value = "displayName") + private String displayName; + + /** + * The application ID. + */ + @JsonProperty(value = "appId") + private String appId; + + /** + * A collection of service principal names. + */ + @JsonProperty(value = "servicePrincipalNames") + private List servicePrincipalNames; + + /** + * Get the display name of the service principal. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the display name of the service principal. + * + * @param displayName the displayName value to set + * @return the ServicePrincipalInner object itself. + */ + public ServicePrincipalInner withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the application ID. + * + * @return the appId value + */ + public String appId() { + return this.appId; + } + + /** + * Set the application ID. + * + * @param appId the appId value to set + * @return the ServicePrincipalInner object itself. + */ + public ServicePrincipalInner withAppId(String appId) { + this.appId = appId; + return this; + } + + /** + * Get a collection of service principal names. + * + * @return the servicePrincipalNames value + */ + public List servicePrincipalNames() { + return this.servicePrincipalNames; + } + + /** + * Set a collection of service principal names. + * + * @param servicePrincipalNames the servicePrincipalNames value to set + * @return the ServicePrincipalInner object itself. + */ + public ServicePrincipalInner withServicePrincipalNames(List servicePrincipalNames) { + this.servicePrincipalNames = servicePrincipalNames; + return this; + } + +} diff --git a/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/ServicePrincipalsInner.java b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/ServicePrincipalsInner.java new file mode 100644 index 000000000000..9dc9749b099f --- /dev/null +++ b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/ServicePrincipalsInner.java @@ -0,0 +1,1109 @@ +/** + * 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.AzureServiceFuture; +import com.microsoft.azure.graphrbac.GraphErrorException; +import com.microsoft.azure.graphrbac.KeyCredentialsUpdateParameters; +import com.microsoft.azure.graphrbac.PasswordCredentialsUpdateParameters; +import com.microsoft.azure.graphrbac.ServicePrincipalCreateParameters; +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; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.PATCH; +import retrofit2.http.Path; +import retrofit2.http.POST; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in ServicePrincipals. + */ +public class ServicePrincipalsInner { + /** The Retrofit service to perform REST calls. */ + private ServicePrincipalsService service; + /** The service client containing this operation class. */ + private GraphRbacManagementClientImpl client; + + /** + * Initializes an instance of ServicePrincipalsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ServicePrincipalsInner(Retrofit retrofit, GraphRbacManagementClientImpl client) { + this.service = retrofit.create(ServicePrincipalsService.class); + this.client = client; + } + + /** + * The interface defining all the services for ServicePrincipals to be + * used by Retrofit to perform actually REST calls. + */ + interface ServicePrincipalsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.graphrbac.ServicePrincipals create" }) + @POST("{tenantID}/servicePrincipals") + Observable> create(@Path("tenantID") String tenantID, @Body ServicePrincipalCreateParameters parameters, @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.graphrbac.ServicePrincipals list" }) + @GET("{tenantID}/servicePrincipals") + Observable> list(@Path("tenantID") String tenantID, @Query("$filter") String filter, @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.graphrbac.ServicePrincipals delete" }) + @HTTP(path = "{tenantID}/servicePrincipals/{objectId}", method = "DELETE", hasBody = true) + Observable> delete(@Path("objectId") String objectId, @Path("tenantID") String tenantID, @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.graphrbac.ServicePrincipals get" }) + @GET("{tenantID}/servicePrincipals/{objectId}") + Observable> get(@Path("objectId") String objectId, @Path("tenantID") String tenantID, @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.graphrbac.ServicePrincipals listOwners" }) + @GET("{tenantID}/servicePrincipals/{objectId}/owners") + Observable> listOwners(@Path("objectId") String objectId, @Path("tenantID") String tenantID, @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.graphrbac.ServicePrincipals listKeyCredentials" }) + @GET("{tenantID}/servicePrincipals/{objectId}/keyCredentials") + Observable> listKeyCredentials(@Path("objectId") String objectId, @Path("tenantID") String tenantID, @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.graphrbac.ServicePrincipals updateKeyCredentials" }) + @PATCH("{tenantID}/servicePrincipals/{objectId}/keyCredentials") + Observable> updateKeyCredentials(@Path("objectId") String objectId, @Path("tenantID") String tenantID, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body KeyCredentialsUpdateParameters parameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.graphrbac.ServicePrincipals listPasswordCredentials" }) + @GET("{tenantID}/servicePrincipals/{objectId}/passwordCredentials") + Observable> listPasswordCredentials(@Path("objectId") String objectId, @Path("tenantID") String tenantID, @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.graphrbac.ServicePrincipals updatePasswordCredentials" }) + @PATCH("{tenantID}/servicePrincipals/{objectId}/passwordCredentials") + Observable> updatePasswordCredentials(@Path("objectId") String objectId, @Path("tenantID") String tenantID, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body PasswordCredentialsUpdateParameters parameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.graphrbac.ServicePrincipals listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Creates a service principal in the directory. + * + * @param parameters Parameters to create a service principal. + * @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 ServicePrincipalInner object if successful. + */ + public ServicePrincipalInner create(ServicePrincipalCreateParameters parameters) { + return createWithServiceResponseAsync(parameters).toBlocking().single().body(); + } + + /** + * Creates a service principal in the directory. + * + * @param parameters Parameters to create a service principal. + * @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 createAsync(ServicePrincipalCreateParameters parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createWithServiceResponseAsync(parameters), serviceCallback); + } + + /** + * Creates a service principal in the directory. + * + * @param parameters Parameters to create a service principal. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ServicePrincipalInner object + */ + public Observable createAsync(ServicePrincipalCreateParameters parameters) { + return createWithServiceResponseAsync(parameters).map(new Func1, ServicePrincipalInner>() { + @Override + public ServicePrincipalInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates a service principal in the directory. + * + * @param parameters Parameters to create a service principal. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ServicePrincipalInner object + */ + public Observable> createWithServiceResponseAsync(ServicePrincipalCreateParameters parameters) { + if (this.client.tenantID() == null) { + throw new IllegalArgumentException("Parameter this.client.tenantID() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + return service.create(this.client.tenantID(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createDelegate(Response response) throws GraphErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(201, new TypeToken() { }.getType()) + .registerError(GraphErrorException.class) + .build(response); + } + + /** + * Gets a list of service principals 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 PagedList<ServicePrincipalInner> object if successful. + */ + public PagedList list() { + ServiceResponse> response = listSinglePageAsync().toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextLink) { + return listNextSinglePageAsync(nextLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets a list of service principals 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> listAsync(final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(), + new Func1>>>() { + @Override + public Observable>> call(String nextLink) { + return listNextSinglePageAsync(nextLink); + } + }, + serviceCallback); + } + + /** + * Gets a list of service principals from the current tenant. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ServicePrincipalInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a list of service principals from the current tenant. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ServicePrincipalInner> object + */ + public Observable>> listWithServiceResponseAsync() { + return listSinglePageAsync() + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextLink = page.body().nextPageLink(); + if (nextLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextLink)); + } + }); + } + + /** + * Gets a list of service principals from the current tenant. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ServicePrincipalInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync() { + if (this.client.tenantID() == null) { + throw new IllegalArgumentException("Parameter this.client.tenantID() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String filter = null; + return service.list(this.client.tenantID(), filter, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Gets a list of service principals from the current tenant. + * + * @param filter The filter to apply to the operation. + * @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 PagedList<ServicePrincipalInner> object if successful. + */ + public PagedList list(final String filter) { + ServiceResponse> response = listSinglePageAsync(filter).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextLink) { + return listNextSinglePageAsync(nextLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets a list of service principals from the current tenant. + * + * @param filter The filter to apply to the 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> listAsync(final String filter, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(filter), + new Func1>>>() { + @Override + public Observable>> call(String nextLink) { + return listNextSinglePageAsync(nextLink); + } + }, + serviceCallback); + } + + /** + * Gets a list of service principals from the current tenant. + * + * @param filter The filter to apply to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ServicePrincipalInner> object + */ + public Observable> listAsync(final String filter) { + return listWithServiceResponseAsync(filter) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a list of service principals from the current tenant. + * + * @param filter The filter to apply to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ServicePrincipalInner> object + */ + public Observable>> listWithServiceResponseAsync(final String filter) { + return listSinglePageAsync(filter) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextLink = page.body().nextPageLink(); + if (nextLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextLink)); + } + }); + } + + /** + * Gets a list of service principals from the current tenant. + * + ServiceResponse> * @param filter The filter to apply to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ServicePrincipalInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final String filter) { + if (this.client.tenantID() == null) { + throw new IllegalArgumentException("Parameter this.client.tenantID() 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.list(this.client.tenantID(), filter, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws GraphErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., GraphErrorException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(GraphErrorException.class) + .build(response); + } + + /** + * Deletes a service principal from the directory. + * + * @param objectId The object ID of the service principal to delete. + * @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 + */ + public void delete(String objectId) { + deleteWithServiceResponseAsync(objectId).toBlocking().single().body(); + } + + /** + * Deletes a service principal from the directory. + * + * @param objectId The object ID of the service principal to delete. + * @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 deleteAsync(String objectId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(objectId), serviceCallback); + } + + /** + * Deletes a service principal from the directory. + * + * @param objectId The object ID of the service principal to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String objectId) { + return deleteWithServiceResponseAsync(objectId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a service principal from the directory. + * + * @param objectId The object ID of the service principal to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String objectId) { + if (objectId == null) { + throw new IllegalArgumentException("Parameter objectId is required and cannot be null."); + } + if (this.client.tenantID() == null) { + throw new IllegalArgumentException("Parameter this.client.tenantID() 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.delete(objectId, this.client.tenantID(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(Response response) throws GraphErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(204, new TypeToken() { }.getType()) + .registerError(GraphErrorException.class) + .build(response); + } + + /** + * Gets service principal information from the directory. Query by objectId or pass a filter to query by appId. + * + * @param objectId The object ID of the service principal to get. + * @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 ServicePrincipalInner object if successful. + */ + public ServicePrincipalInner get(String objectId) { + return getWithServiceResponseAsync(objectId).toBlocking().single().body(); + } + + /** + * Gets service principal information from the directory. Query by objectId or pass a filter to query by appId. + * + * @param objectId The object ID of the service principal to get. + * @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 objectId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(objectId), serviceCallback); + } + + /** + * Gets service principal information from the directory. Query by objectId or pass a filter to query by appId. + * + * @param objectId The object ID of the service principal to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ServicePrincipalInner object + */ + public Observable getAsync(String objectId) { + return getWithServiceResponseAsync(objectId).map(new Func1, ServicePrincipalInner>() { + @Override + public ServicePrincipalInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets service principal information from the directory. Query by objectId or pass a filter to query by appId. + * + * @param objectId The object ID of the service principal to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ServicePrincipalInner object + */ + public Observable> getWithServiceResponseAsync(String objectId) { + if (objectId == null) { + throw new IllegalArgumentException("Parameter objectId is required and cannot be null."); + } + if (this.client.tenantID() == null) { + throw new IllegalArgumentException("Parameter this.client.tenantID() 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(objectId, this.client.tenantID(), 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 GraphErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(GraphErrorException.class) + .build(response); + } + + /** + * Directory objects that are owners of this service principal. + * The owners are a set of non-admin users who are allowed to modify this object. + * + * @param objectId The object ID of the service principal for which to get owners. + * @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 List<DirectoryObjectInner> object if successful. + */ + public List listOwners(String objectId) { + return listOwnersWithServiceResponseAsync(objectId).toBlocking().single().body(); + } + + /** + * Directory objects that are owners of this service principal. + * The owners are a set of non-admin users who are allowed to modify this object. + * + * @param objectId The object ID of the service principal for which to get owners. + * @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> listOwnersAsync(String objectId, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listOwnersWithServiceResponseAsync(objectId), serviceCallback); + } + + /** + * Directory objects that are owners of this service principal. + * The owners are a set of non-admin users who are allowed to modify this object. + * + * @param objectId The object ID of the service principal for which to get owners. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<DirectoryObjectInner> object + */ + public Observable> listOwnersAsync(String objectId) { + return listOwnersWithServiceResponseAsync(objectId).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Directory objects that are owners of this service principal. + * The owners are a set of non-admin users who are allowed to modify this object. + * + * @param objectId The object ID of the service principal for which to get owners. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<DirectoryObjectInner> object + */ + public Observable>> listOwnersWithServiceResponseAsync(String objectId) { + if (objectId == null) { + throw new IllegalArgumentException("Parameter objectId is required and cannot be null."); + } + if (this.client.tenantID() == null) { + throw new IllegalArgumentException("Parameter this.client.tenantID() 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.listOwners(objectId, this.client.tenantID(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listOwnersDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listOwnersDelegate(Response response) throws GraphErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., GraphErrorException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(GraphErrorException.class) + .build(response); + } + + /** + * Get the keyCredentials associated with the specified service principal. + * + * @param objectId The object ID of the service principal for which to get keyCredentials. + * @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 List<KeyCredentialInner> object if successful. + */ + public List listKeyCredentials(String objectId) { + return listKeyCredentialsWithServiceResponseAsync(objectId).toBlocking().single().body(); + } + + /** + * Get the keyCredentials associated with the specified service principal. + * + * @param objectId The object ID of the service principal for which to get keyCredentials. + * @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> listKeyCredentialsAsync(String objectId, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listKeyCredentialsWithServiceResponseAsync(objectId), serviceCallback); + } + + /** + * Get the keyCredentials associated with the specified service principal. + * + * @param objectId The object ID of the service principal for which to get keyCredentials. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<KeyCredentialInner> object + */ + public Observable> listKeyCredentialsAsync(String objectId) { + return listKeyCredentialsWithServiceResponseAsync(objectId).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Get the keyCredentials associated with the specified service principal. + * + * @param objectId The object ID of the service principal for which to get keyCredentials. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<KeyCredentialInner> object + */ + public Observable>> listKeyCredentialsWithServiceResponseAsync(String objectId) { + if (objectId == null) { + throw new IllegalArgumentException("Parameter objectId is required and cannot be null."); + } + if (this.client.tenantID() == null) { + throw new IllegalArgumentException("Parameter this.client.tenantID() 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.listKeyCredentials(objectId, this.client.tenantID(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listKeyCredentialsDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listKeyCredentialsDelegate(Response response) throws GraphErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., GraphErrorException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(GraphErrorException.class) + .build(response); + } + + /** + * Update the keyCredentials associated with a service principal. + * + * @param objectId The object ID for which to get service principal information. + * @param value A collection of KeyCredentials. + * @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 + */ + public void updateKeyCredentials(String objectId, List value) { + updateKeyCredentialsWithServiceResponseAsync(objectId, value).toBlocking().single().body(); + } + + /** + * Update the keyCredentials associated with a service principal. + * + * @param objectId The object ID for which to get service principal information. + * @param value A collection of KeyCredentials. + * @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 updateKeyCredentialsAsync(String objectId, List value, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateKeyCredentialsWithServiceResponseAsync(objectId, value), serviceCallback); + } + + /** + * Update the keyCredentials associated with a service principal. + * + * @param objectId The object ID for which to get service principal information. + * @param value A collection of KeyCredentials. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable updateKeyCredentialsAsync(String objectId, List value) { + return updateKeyCredentialsWithServiceResponseAsync(objectId, value).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Update the keyCredentials associated with a service principal. + * + * @param objectId The object ID for which to get service principal information. + * @param value A collection of KeyCredentials. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> updateKeyCredentialsWithServiceResponseAsync(String objectId, List value) { + if (objectId == null) { + throw new IllegalArgumentException("Parameter objectId is required and cannot be null."); + } + if (this.client.tenantID() == null) { + throw new IllegalArgumentException("Parameter this.client.tenantID() 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 (value == null) { + throw new IllegalArgumentException("Parameter value is required and cannot be null."); + } + Validator.validate(value); + KeyCredentialsUpdateParameters parameters = new KeyCredentialsUpdateParameters(); + parameters.withValue(value); + return service.updateKeyCredentials(objectId, this.client.tenantID(), this.client.apiVersion(), this.client.acceptLanguage(), parameters, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = updateKeyCredentialsDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse updateKeyCredentialsDelegate(Response response) throws GraphErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(204, new TypeToken() { }.getType()) + .registerError(GraphErrorException.class) + .build(response); + } + + /** + * Gets the passwordCredentials associated with a service principal. + * + * @param objectId The object ID of the service principal. + * @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 List<PasswordCredentialInner> object if successful. + */ + public List listPasswordCredentials(String objectId) { + return listPasswordCredentialsWithServiceResponseAsync(objectId).toBlocking().single().body(); + } + + /** + * Gets the passwordCredentials associated with a service principal. + * + * @param objectId The object ID of the service principal. + * @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> listPasswordCredentialsAsync(String objectId, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listPasswordCredentialsWithServiceResponseAsync(objectId), serviceCallback); + } + + /** + * Gets the passwordCredentials associated with a service principal. + * + * @param objectId The object ID of the service principal. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<PasswordCredentialInner> object + */ + public Observable> listPasswordCredentialsAsync(String objectId) { + return listPasswordCredentialsWithServiceResponseAsync(objectId).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets the passwordCredentials associated with a service principal. + * + * @param objectId The object ID of the service principal. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<PasswordCredentialInner> object + */ + public Observable>> listPasswordCredentialsWithServiceResponseAsync(String objectId) { + if (objectId == null) { + throw new IllegalArgumentException("Parameter objectId is required and cannot be null."); + } + if (this.client.tenantID() == null) { + throw new IllegalArgumentException("Parameter this.client.tenantID() 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.listPasswordCredentials(objectId, this.client.tenantID(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listPasswordCredentialsDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listPasswordCredentialsDelegate(Response response) throws GraphErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., GraphErrorException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(GraphErrorException.class) + .build(response); + } + + /** + * Updates the passwordCredentials associated with a service principal. + * + * @param objectId The object ID of the service principal. + * @param value A collection of PasswordCredentials. + * @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 + */ + public void updatePasswordCredentials(String objectId, List value) { + updatePasswordCredentialsWithServiceResponseAsync(objectId, value).toBlocking().single().body(); + } + + /** + * Updates the passwordCredentials associated with a service principal. + * + * @param objectId The object ID of the service principal. + * @param value A collection of PasswordCredentials. + * @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 updatePasswordCredentialsAsync(String objectId, List value, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updatePasswordCredentialsWithServiceResponseAsync(objectId, value), serviceCallback); + } + + /** + * Updates the passwordCredentials associated with a service principal. + * + * @param objectId The object ID of the service principal. + * @param value A collection of PasswordCredentials. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable updatePasswordCredentialsAsync(String objectId, List value) { + return updatePasswordCredentialsWithServiceResponseAsync(objectId, value).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates the passwordCredentials associated with a service principal. + * + * @param objectId The object ID of the service principal. + * @param value A collection of PasswordCredentials. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> updatePasswordCredentialsWithServiceResponseAsync(String objectId, List value) { + if (objectId == null) { + throw new IllegalArgumentException("Parameter objectId is required and cannot be null."); + } + if (this.client.tenantID() == null) { + throw new IllegalArgumentException("Parameter this.client.tenantID() 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 (value == null) { + throw new IllegalArgumentException("Parameter value is required and cannot be null."); + } + Validator.validate(value); + PasswordCredentialsUpdateParameters parameters = new PasswordCredentialsUpdateParameters(); + parameters.withValue(value); + return service.updatePasswordCredentials(objectId, this.client.tenantID(), this.client.apiVersion(), this.client.acceptLanguage(), parameters, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = updatePasswordCredentialsDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse updatePasswordCredentialsDelegate(Response response) throws GraphErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(204, new TypeToken() { }.getType()) + .registerError(GraphErrorException.class) + .build(response); + } + + /** + * Gets a list of service principals from the current tenant. + * + * @param nextLink Next link for the list operation. + * @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 PagedList<ServicePrincipalInner> object if successful. + */ + public PagedList listNext(final String nextLink) { + ServiceResponse> response = listNextSinglePageAsync(nextLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextLink) { + return listNextSinglePageAsync(nextLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets a list of service principals from the current tenant. + * + * @param nextLink Next link for the 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> listNextAsync(final String nextLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextLink), + new Func1>>>() { + @Override + public Observable>> call(String nextLink) { + return listNextSinglePageAsync(nextLink); + } + }, + serviceCallback); + } + + /** + * Gets a list of service principals from the current tenant. + * + * @param nextLink Next link for the list operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ServicePrincipalInner> object + */ + public Observable> listNextAsync(final String nextLink) { + return listNextWithServiceResponseAsync(nextLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a list of service principals from the current tenant. + * + * @param nextLink Next link for the list operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ServicePrincipalInner> object + */ + public Observable>> listNextWithServiceResponseAsync(final String nextLink) { + return listNextSinglePageAsync(nextLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextLink = page.body().nextPageLink(); + if (nextLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextLink)); + } + }); + } + + /** + * Gets a list of service principals from the current tenant. + * + ServiceResponse> * @param nextLink Next link for the list operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ServicePrincipalInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listNextSinglePageAsync(final String nextLink) { + if (nextLink == null) { + throw new IllegalArgumentException("Parameter nextLink is required and cannot be null."); + } + if (this.client.tenantID() == null) { + throw new IllegalArgumentException("Parameter this.client.tenantID() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + String nextUrl = String.format("%s/%s", this.client.tenantID(), nextLink); + return service.listNext(nextUrl, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listNextDelegate(Response response) throws GraphErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., GraphErrorException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(GraphErrorException.class) + .build(response); + } + +} diff --git a/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/UserInner.java b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/UserInner.java new file mode 100644 index 000000000000..3d3ce1331503 --- /dev/null +++ b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/UserInner.java @@ -0,0 +1,318 @@ +/** + * 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.microsoft.azure.graphrbac.UserType; +import java.util.List; +import com.microsoft.azure.graphrbac.SignInName; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * Active Directory user information. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "objectType") +@JsonTypeName("User") +public class UserInner extends DirectoryObjectInner { + /** + * This must be specified if you are using a federated domain for the + * user's userPrincipalName (UPN) property when creating a new user + * account. It is used to associate an on-premises Active Directory user + * account with their Azure AD user object. + */ + @JsonProperty(value = "immutableId") + private String immutableId; + + /** + * A two letter country code (ISO standard 3166). Required for users that + * will be assigned licenses due to legal requirement to check for + * availability of services in countries. Examples include: "US", "JP", and + * "GB". + */ + @JsonProperty(value = "usageLocation") + private String usageLocation; + + /** + * The given name for the user. + */ + @JsonProperty(value = "givenName") + private String givenName; + + /** + * The user's surname (family name or last name). + */ + @JsonProperty(value = "surname") + private String surname; + + /** + * A string value that can be used to classify user types in your + * directory, such as 'Member' and 'Guest'. Possible values include: + * 'Member', 'Guest'. + */ + @JsonProperty(value = "userType") + private UserType userType; + + /** + * Whether the account is enabled. + */ + @JsonProperty(value = "accountEnabled") + private Boolean accountEnabled; + + /** + * The display name of the user. + */ + @JsonProperty(value = "displayName") + private String displayName; + + /** + * The principal name of the user. + */ + @JsonProperty(value = "userPrincipalName") + private String userPrincipalName; + + /** + * The mail alias for the user. + */ + @JsonProperty(value = "mailNickname") + private String mailNickname; + + /** + * The primary email address of the user. + */ + @JsonProperty(value = "mail") + private String mail; + + /** + * The sign-in names of the user. + */ + @JsonProperty(value = "signInNames") + private List signInNames; + + /** + * Get this must be specified if you are using a federated domain for the user's userPrincipalName (UPN) property when creating a new user account. It is used to associate an on-premises Active Directory user account with their Azure AD user object. + * + * @return the immutableId value + */ + public String immutableId() { + return this.immutableId; + } + + /** + * Set this must be specified if you are using a federated domain for the user's userPrincipalName (UPN) property when creating a new user account. It is used to associate an on-premises Active Directory user account with their Azure AD user object. + * + * @param immutableId the immutableId value to set + * @return the UserInner object itself. + */ + public UserInner withImmutableId(String immutableId) { + this.immutableId = immutableId; + return this; + } + + /** + * Get a two letter country code (ISO standard 3166). Required for users that will be assigned licenses due to legal requirement to check for availability of services in countries. Examples include: "US", "JP", and "GB". + * + * @return the usageLocation value + */ + public String usageLocation() { + return this.usageLocation; + } + + /** + * Set a two letter country code (ISO standard 3166). Required for users that will be assigned licenses due to legal requirement to check for availability of services in countries. Examples include: "US", "JP", and "GB". + * + * @param usageLocation the usageLocation value to set + * @return the UserInner object itself. + */ + public UserInner withUsageLocation(String usageLocation) { + this.usageLocation = usageLocation; + return this; + } + + /** + * Get the given name for the user. + * + * @return the givenName value + */ + public String givenName() { + return this.givenName; + } + + /** + * Set the given name for the user. + * + * @param givenName the givenName value to set + * @return the UserInner object itself. + */ + public UserInner withGivenName(String givenName) { + this.givenName = givenName; + return this; + } + + /** + * Get the user's surname (family name or last name). + * + * @return the surname value + */ + public String surname() { + return this.surname; + } + + /** + * Set the user's surname (family name or last name). + * + * @param surname the surname value to set + * @return the UserInner object itself. + */ + public UserInner withSurname(String surname) { + this.surname = surname; + return this; + } + + /** + * Get a string value that can be used to classify user types in your directory, such as 'Member' and 'Guest'. Possible values include: 'Member', 'Guest'. + * + * @return the userType value + */ + public UserType userType() { + return this.userType; + } + + /** + * Set a string value that can be used to classify user types in your directory, such as 'Member' and 'Guest'. Possible values include: 'Member', 'Guest'. + * + * @param userType the userType value to set + * @return the UserInner object itself. + */ + public UserInner withUserType(UserType userType) { + this.userType = userType; + return this; + } + + /** + * Get whether the account is enabled. + * + * @return the accountEnabled value + */ + public Boolean accountEnabled() { + return this.accountEnabled; + } + + /** + * Set whether the account is enabled. + * + * @param accountEnabled the accountEnabled value to set + * @return the UserInner object itself. + */ + public UserInner withAccountEnabled(Boolean accountEnabled) { + this.accountEnabled = accountEnabled; + return this; + } + + /** + * Get the display name of the user. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the display name of the user. + * + * @param displayName the displayName value to set + * @return the UserInner object itself. + */ + public UserInner withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the principal name of the user. + * + * @return the userPrincipalName value + */ + public String userPrincipalName() { + return this.userPrincipalName; + } + + /** + * Set the principal name of the user. + * + * @param userPrincipalName the userPrincipalName value to set + * @return the UserInner object itself. + */ + public UserInner withUserPrincipalName(String userPrincipalName) { + this.userPrincipalName = userPrincipalName; + return this; + } + + /** + * Get the mail alias for the user. + * + * @return the mailNickname value + */ + public String mailNickname() { + return this.mailNickname; + } + + /** + * Set the mail alias for the user. + * + * @param mailNickname the mailNickname value to set + * @return the UserInner object itself. + */ + public UserInner withMailNickname(String mailNickname) { + this.mailNickname = mailNickname; + return this; + } + + /** + * Get the primary email address of the user. + * + * @return the mail value + */ + public String mail() { + return this.mail; + } + + /** + * Set the primary email address of the user. + * + * @param mail the mail value to set + * @return the UserInner object itself. + */ + public UserInner withMail(String mail) { + this.mail = mail; + return this; + } + + /** + * Get the sign-in names of the user. + * + * @return the signInNames value + */ + public List signInNames() { + return this.signInNames; + } + + /** + * Set the sign-in names of the user. + * + * @param signInNames the signInNames value to set + * @return the UserInner object itself. + */ + public UserInner withSignInNames(List signInNames) { + this.signInNames = signInNames; + return this; + } + +} diff --git a/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/UsersInner.java b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/UsersInner.java new file mode 100644 index 000000000000..23046b8298de --- /dev/null +++ b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/UsersInner.java @@ -0,0 +1,843 @@ +/** + * 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.AzureServiceFuture; +import com.microsoft.azure.graphrbac.GraphErrorException; +import com.microsoft.azure.graphrbac.UserCreateParameters; +import com.microsoft.azure.graphrbac.UserGetMemberGroupsParameters; +import com.microsoft.azure.graphrbac.UserUpdateParameters; +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; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.PATCH; +import retrofit2.http.Path; +import retrofit2.http.POST; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Users. + */ +public class UsersInner { + /** The Retrofit service to perform REST calls. */ + private UsersService service; + /** The service client containing this operation class. */ + private GraphRbacManagementClientImpl client; + + /** + * Initializes an instance of UsersInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public UsersInner(Retrofit retrofit, GraphRbacManagementClientImpl client) { + this.service = retrofit.create(UsersService.class); + this.client = client; + } + + /** + * The interface defining all the services for Users to be + * used by Retrofit to perform actually REST calls. + */ + interface UsersService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.graphrbac.Users create" }) + @POST("{tenantID}/users") + Observable> create(@Path("tenantID") String tenantID, @Body UserCreateParameters parameters, @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.graphrbac.Users list" }) + @GET("{tenantID}/users") + Observable> list(@Path("tenantID") String tenantID, @Query("$filter") String filter, @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.graphrbac.Users get" }) + @GET("{tenantID}/users/{upnOrObjectId}") + Observable> get(@Path("upnOrObjectId") String upnOrObjectId, @Path("tenantID") String tenantID, @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.graphrbac.Users update" }) + @PATCH("{tenantID}/users/{upnOrObjectId}") + Observable> update(@Path("upnOrObjectId") String upnOrObjectId, @Path("tenantID") String tenantID, @Body UserUpdateParameters parameters, @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.graphrbac.Users delete" }) + @HTTP(path = "{tenantID}/users/{upnOrObjectId}", method = "DELETE", hasBody = true) + Observable> delete(@Path("upnOrObjectId") String upnOrObjectId, @Path("tenantID") String tenantID, @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.graphrbac.Users getMemberGroups" }) + @POST("{tenantID}/users/{objectId}/getMemberGroups") + Observable> getMemberGroups(@Path("objectId") String objectId, @Path("tenantID") String tenantID, @Body UserGetMemberGroupsParameters parameters, @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.graphrbac.Users listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Create a new user. + * + * @param parameters Parameters to create a user. + * @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 UserInner object if successful. + */ + public UserInner create(UserCreateParameters parameters) { + return createWithServiceResponseAsync(parameters).toBlocking().single().body(); + } + + /** + * Create a new user. + * + * @param parameters Parameters to create a user. + * @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 createAsync(UserCreateParameters parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createWithServiceResponseAsync(parameters), serviceCallback); + } + + /** + * Create a new user. + * + * @param parameters Parameters to create a user. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the UserInner object + */ + public Observable createAsync(UserCreateParameters parameters) { + return createWithServiceResponseAsync(parameters).map(new Func1, UserInner>() { + @Override + public UserInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create a new user. + * + * @param parameters Parameters to create a user. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the UserInner object + */ + public Observable> createWithServiceResponseAsync(UserCreateParameters parameters) { + if (this.client.tenantID() == null) { + throw new IllegalArgumentException("Parameter this.client.tenantID() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + return service.create(this.client.tenantID(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createDelegate(Response response) throws GraphErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(201, new TypeToken() { }.getType()) + .registerError(GraphErrorException.class) + .build(response); + } + + /** + * Gets list of users for 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 PagedList<UserInner> object if successful. + */ + public PagedList list() { + ServiceResponse> response = listSinglePageAsync().toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextLink) { + return listNextSinglePageAsync(nextLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets list of users for 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> listAsync(final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(), + new Func1>>>() { + @Override + public Observable>> call(String nextLink) { + return listNextSinglePageAsync(nextLink); + } + }, + serviceCallback); + } + + /** + * Gets list of users for the current tenant. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<UserInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets list of users for the current tenant. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<UserInner> object + */ + public Observable>> listWithServiceResponseAsync() { + return listSinglePageAsync() + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextLink = page.body().nextPageLink(); + if (nextLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextLink)); + } + }); + } + + /** + * Gets list of users for the current tenant. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<UserInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync() { + if (this.client.tenantID() == null) { + throw new IllegalArgumentException("Parameter this.client.tenantID() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String filter = null; + return service.list(this.client.tenantID(), filter, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Gets list of users for the current tenant. + * + * @param filter The filter to apply to the operation. + * @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 PagedList<UserInner> object if successful. + */ + public PagedList list(final String filter) { + ServiceResponse> response = listSinglePageAsync(filter).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextLink) { + return listNextSinglePageAsync(nextLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets list of users for the current tenant. + * + * @param filter The filter to apply to the 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> listAsync(final String filter, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(filter), + new Func1>>>() { + @Override + public Observable>> call(String nextLink) { + return listNextSinglePageAsync(nextLink); + } + }, + serviceCallback); + } + + /** + * Gets list of users for the current tenant. + * + * @param filter The filter to apply to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<UserInner> object + */ + public Observable> listAsync(final String filter) { + return listWithServiceResponseAsync(filter) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets list of users for the current tenant. + * + * @param filter The filter to apply to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<UserInner> object + */ + public Observable>> listWithServiceResponseAsync(final String filter) { + return listSinglePageAsync(filter) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextLink = page.body().nextPageLink(); + if (nextLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextLink)); + } + }); + } + + /** + * Gets list of users for the current tenant. + * + ServiceResponse> * @param filter The filter to apply to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<UserInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final String filter) { + if (this.client.tenantID() == null) { + throw new IllegalArgumentException("Parameter this.client.tenantID() 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.list(this.client.tenantID(), filter, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws GraphErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., GraphErrorException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(GraphErrorException.class) + .build(response); + } + + /** + * Gets user information from the directory. + * + * @param upnOrObjectId The object ID or principal name of the user for which to get information. + * @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 UserInner object if successful. + */ + public UserInner get(String upnOrObjectId) { + return getWithServiceResponseAsync(upnOrObjectId).toBlocking().single().body(); + } + + /** + * Gets user information from the directory. + * + * @param upnOrObjectId The object ID or principal name of the user for which to get information. + * @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 upnOrObjectId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(upnOrObjectId), serviceCallback); + } + + /** + * Gets user information from the directory. + * + * @param upnOrObjectId The object ID or principal name of the user for which to get information. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the UserInner object + */ + public Observable getAsync(String upnOrObjectId) { + return getWithServiceResponseAsync(upnOrObjectId).map(new Func1, UserInner>() { + @Override + public UserInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets user information from the directory. + * + * @param upnOrObjectId The object ID or principal name of the user for which to get information. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the UserInner object + */ + public Observable> getWithServiceResponseAsync(String upnOrObjectId) { + if (upnOrObjectId == null) { + throw new IllegalArgumentException("Parameter upnOrObjectId is required and cannot be null."); + } + if (this.client.tenantID() == null) { + throw new IllegalArgumentException("Parameter this.client.tenantID() 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(upnOrObjectId, this.client.tenantID(), 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 GraphErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(GraphErrorException.class) + .build(response); + } + + /** + * Updates a user. + * + * @param upnOrObjectId The object ID or principal name of the user to update. + * @param parameters Parameters to update an existing user. + * @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 + */ + public void update(String upnOrObjectId, UserUpdateParameters parameters) { + updateWithServiceResponseAsync(upnOrObjectId, parameters).toBlocking().single().body(); + } + + /** + * Updates a user. + * + * @param upnOrObjectId The object ID or principal name of the user to update. + * @param parameters Parameters to update an existing user. + * @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 updateAsync(String upnOrObjectId, UserUpdateParameters parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(upnOrObjectId, parameters), serviceCallback); + } + + /** + * Updates a user. + * + * @param upnOrObjectId The object ID or principal name of the user to update. + * @param parameters Parameters to update an existing user. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable updateAsync(String upnOrObjectId, UserUpdateParameters parameters) { + return updateWithServiceResponseAsync(upnOrObjectId, parameters).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates a user. + * + * @param upnOrObjectId The object ID or principal name of the user to update. + * @param parameters Parameters to update an existing user. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> updateWithServiceResponseAsync(String upnOrObjectId, UserUpdateParameters parameters) { + if (upnOrObjectId == null) { + throw new IllegalArgumentException("Parameter upnOrObjectId is required and cannot be null."); + } + if (this.client.tenantID() == null) { + throw new IllegalArgumentException("Parameter this.client.tenantID() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + return service.update(upnOrObjectId, this.client.tenantID(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = updateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse updateDelegate(Response response) throws GraphErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(204, new TypeToken() { }.getType()) + .registerError(GraphErrorException.class) + .build(response); + } + + /** + * Delete a user. + * + * @param upnOrObjectId The object ID or principal name of the user to delete. + * @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 + */ + public void delete(String upnOrObjectId) { + deleteWithServiceResponseAsync(upnOrObjectId).toBlocking().single().body(); + } + + /** + * Delete a user. + * + * @param upnOrObjectId The object ID or principal name of the user to delete. + * @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 deleteAsync(String upnOrObjectId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(upnOrObjectId), serviceCallback); + } + + /** + * Delete a user. + * + * @param upnOrObjectId The object ID or principal name of the user to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String upnOrObjectId) { + return deleteWithServiceResponseAsync(upnOrObjectId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Delete a user. + * + * @param upnOrObjectId The object ID or principal name of the user to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String upnOrObjectId) { + if (upnOrObjectId == null) { + throw new IllegalArgumentException("Parameter upnOrObjectId is required and cannot be null."); + } + if (this.client.tenantID() == null) { + throw new IllegalArgumentException("Parameter this.client.tenantID() 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.delete(upnOrObjectId, this.client.tenantID(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(Response response) throws GraphErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(204, new TypeToken() { }.getType()) + .registerError(GraphErrorException.class) + .build(response); + } + + /** + * Gets a collection that contains the object IDs of the groups of which the user is a member. + * + * @param objectId The object ID of the user for which to get group membership. + * @param parameters User filtering parameters. + * @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 List<String> object if successful. + */ + public List getMemberGroups(String objectId, UserGetMemberGroupsParameters parameters) { + return getMemberGroupsWithServiceResponseAsync(objectId, parameters).toBlocking().single().body(); + } + + /** + * Gets a collection that contains the object IDs of the groups of which the user is a member. + * + * @param objectId The object ID of the user for which to get group membership. + * @param parameters User filtering parameters. + * @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> getMemberGroupsAsync(String objectId, UserGetMemberGroupsParameters parameters, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(getMemberGroupsWithServiceResponseAsync(objectId, parameters), serviceCallback); + } + + /** + * Gets a collection that contains the object IDs of the groups of which the user is a member. + * + * @param objectId The object ID of the user for which to get group membership. + * @param parameters User filtering parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<String> object + */ + public Observable> getMemberGroupsAsync(String objectId, UserGetMemberGroupsParameters parameters) { + return getMemberGroupsWithServiceResponseAsync(objectId, parameters).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a collection that contains the object IDs of the groups of which the user is a member. + * + * @param objectId The object ID of the user for which to get group membership. + * @param parameters User filtering parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<String> object + */ + public Observable>> getMemberGroupsWithServiceResponseAsync(String objectId, UserGetMemberGroupsParameters parameters) { + if (objectId == null) { + throw new IllegalArgumentException("Parameter objectId is required and cannot be null."); + } + if (this.client.tenantID() == null) { + throw new IllegalArgumentException("Parameter this.client.tenantID() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + return service.getMemberGroups(objectId, this.client.tenantID(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = getMemberGroupsDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> getMemberGroupsDelegate(Response response) throws GraphErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., GraphErrorException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(GraphErrorException.class) + .build(response); + } + + /** + * Gets a list of users for the current tenant. + * + * @param nextLink Next link for the list operation. + * @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 PagedList<UserInner> object if successful. + */ + public PagedList listNext(final String nextLink) { + ServiceResponse> response = listNextSinglePageAsync(nextLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextLink) { + return listNextSinglePageAsync(nextLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets a list of users for the current tenant. + * + * @param nextLink Next link for the 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> listNextAsync(final String nextLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextLink), + new Func1>>>() { + @Override + public Observable>> call(String nextLink) { + return listNextSinglePageAsync(nextLink); + } + }, + serviceCallback); + } + + /** + * Gets a list of users for the current tenant. + * + * @param nextLink Next link for the list operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<UserInner> object + */ + public Observable> listNextAsync(final String nextLink) { + return listNextWithServiceResponseAsync(nextLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a list of users for the current tenant. + * + * @param nextLink Next link for the list operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<UserInner> object + */ + public Observable>> listNextWithServiceResponseAsync(final String nextLink) { + return listNextSinglePageAsync(nextLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextLink = page.body().nextPageLink(); + if (nextLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextLink)); + } + }); + } + + /** + * Gets a list of users for the current tenant. + * + ServiceResponse> * @param nextLink Next link for the list operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<UserInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listNextSinglePageAsync(final String nextLink) { + if (nextLink == null) { + throw new IllegalArgumentException("Parameter nextLink is required and cannot be null."); + } + if (this.client.tenantID() == null) { + throw new IllegalArgumentException("Parameter this.client.tenantID() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + String nextUrl = String.format("%s/%s", this.client.tenantID(), nextLink); + return service.listNext(nextUrl, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listNextDelegate(Response response) throws GraphErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., GraphErrorException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(GraphErrorException.class) + .build(response); + } + +} diff --git a/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/package-info.java b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/package-info.java new file mode 100644 index 000000000000..c04a3537d565 --- /dev/null +++ b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/package-info.java @@ -0,0 +1,11 @@ +// 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. + +/** + * This package contains the implementation classes for GraphRbacManagementClient. + * The Graph RBAC Management Client. + */ +package com.microsoft.azure.graphrbac.implementation; diff --git a/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/package-info.java b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/package-info.java new file mode 100644 index 000000000000..45595d4c3dc5 --- /dev/null +++ b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/package-info.java @@ -0,0 +1,11 @@ +// 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. + +/** + * This package contains the classes for GraphRbacManagementClient. + * The Graph RBAC Management Client. + */ +package com.microsoft.azure.graphrbac;