diff --git a/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/ApplicationsOperations.cs b/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/ApplicationsOperations.cs index 1639fd849900..688a1a601903 100644 --- a/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/ApplicationsOperations.cs +++ b/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/ApplicationsOperations.cs @@ -976,7 +976,7 @@ internal ApplicationsOperations(GraphRbacManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListOwnersWithHttpMessagesAsync(string applicationObjectId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListOwnersWithHttpMessagesAsync(string applicationObjectId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (applicationObjectId == null) { @@ -1099,7 +1099,7 @@ internal ApplicationsOperations(GraphRbacManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -1112,7 +1112,7 @@ internal ApplicationsOperations(GraphRbacManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -1159,7 +1159,7 @@ internal ApplicationsOperations(GraphRbacManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task AddOwnerWithHttpMessagesAsync(string applicationObjectId, ApplicationAddOwnerParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task AddOwnerWithHttpMessagesAsync(string applicationObjectId, AddOwnerParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (applicationObjectId == null) { @@ -1311,6 +1311,176 @@ internal ApplicationsOperations(GraphRbacManagementClient client) return _result; } + /// + /// Remove a member from owners. + /// + /// + /// The object ID of the application from which to remove the owner. + /// + /// + /// Owner object id + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task RemoveOwnerWithHttpMessagesAsync(string applicationObjectId, string ownerObjectId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (applicationObjectId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "applicationObjectId"); + } + if (ownerObjectId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ownerObjectId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.TenantID == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.TenantID"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("applicationObjectId", applicationObjectId); + tracingParameters.Add("ownerObjectId", ownerObjectId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "RemoveOwner", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{tenantID}/applications/{applicationObjectId}/$links/owners/{ownerObjectId}").ToString(); + _url = _url.Replace("{applicationObjectId}", System.Uri.EscapeDataString(applicationObjectId)); + _url = _url.Replace("{ownerObjectId}", System.Uri.EscapeDataString(ownerObjectId)); + _url = _url.Replace("{tenantID}", System.Uri.EscapeDataString(Client.TenantID)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 204) + { + var ex = new GraphErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + GraphError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + /// /// Get the keyCredentials associated with an application. /// @@ -2207,5 +2377,177 @@ internal ApplicationsOperations(GraphRbacManagementClient client) return _result; } + /// + /// Directory objects that are owners of the application. + /// + /// + /// The owners are a set of non-admin users who are allowed to modify this + /// object. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListOwnersNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListOwnersNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new GraphErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + GraphError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + } } diff --git a/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/ApplicationsOperationsExtensions.cs b/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/ApplicationsOperationsExtensions.cs index 316875063879..61e9316e3175 100644 --- a/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/ApplicationsOperationsExtensions.cs +++ b/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/ApplicationsOperationsExtensions.cs @@ -207,7 +207,7 @@ public static void Patch(this IApplicationsOperations operations, string applica /// /// The object ID of the application for which to get owners. /// - public static IEnumerable ListOwners(this IApplicationsOperations operations, string applicationObjectId) + public static IPage ListOwners(this IApplicationsOperations operations, string applicationObjectId) { return operations.ListOwnersAsync(applicationObjectId).GetAwaiter().GetResult(); } @@ -228,7 +228,7 @@ public static IEnumerable ListOwners(this IApplicationsOperatio /// /// The cancellation token. /// - public static async Task> ListOwnersAsync(this IApplicationsOperations operations, string applicationObjectId, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListOwnersAsync(this IApplicationsOperations operations, string applicationObjectId, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.ListOwnersWithHttpMessagesAsync(applicationObjectId, null, cancellationToken).ConfigureAwait(false)) { @@ -249,7 +249,7 @@ public static IEnumerable ListOwners(this IApplicationsOperatio /// The URL of the owner object, such as /// https://graph.windows.net/0b1f9851-1bf0-433f-aec3-cb9272f093dc/directoryObjects/f260bbc4-c254-447b-94cf-293b5ec434dd. /// - public static void AddOwner(this IApplicationsOperations operations, string applicationObjectId, ApplicationAddOwnerParameters parameters) + public static void AddOwner(this IApplicationsOperations operations, string applicationObjectId, AddOwnerParameters parameters) { operations.AddOwnerAsync(applicationObjectId, parameters).GetAwaiter().GetResult(); } @@ -270,11 +270,48 @@ public static void AddOwner(this IApplicationsOperations operations, string appl /// /// The cancellation token. /// - public static async Task AddOwnerAsync(this IApplicationsOperations operations, string applicationObjectId, ApplicationAddOwnerParameters parameters, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task AddOwnerAsync(this IApplicationsOperations operations, string applicationObjectId, AddOwnerParameters parameters, CancellationToken cancellationToken = default(CancellationToken)) { (await operations.AddOwnerWithHttpMessagesAsync(applicationObjectId, parameters, null, cancellationToken).ConfigureAwait(false)).Dispose(); } + /// + /// Remove a member from owners. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The object ID of the application from which to remove the owner. + /// + /// + /// Owner object id + /// + public static void RemoveOwner(this IApplicationsOperations operations, string applicationObjectId, string ownerObjectId) + { + operations.RemoveOwnerAsync(applicationObjectId, ownerObjectId).GetAwaiter().GetResult(); + } + + /// + /// Remove a member from owners. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The object ID of the application from which to remove the owner. + /// + /// + /// Owner object id + /// + /// + /// The cancellation token. + /// + public static async Task RemoveOwnerAsync(this IApplicationsOperations operations, string applicationObjectId, string ownerObjectId, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.RemoveOwnerWithHttpMessagesAsync(applicationObjectId, ownerObjectId, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// /// Get the keyCredentials associated with an application. /// @@ -451,5 +488,47 @@ public static IPage ListNext(this IApplicationsOperations operation } } + /// + /// Directory objects that are owners of the application. + /// + /// + /// The owners are a set of non-admin users who are allowed to modify this + /// object. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListOwnersNext(this IApplicationsOperations operations, string nextPageLink) + { + return operations.ListOwnersNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Directory objects that are owners of the application. + /// + /// + /// The owners are a set of non-admin users who are allowed to modify this + /// object. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListOwnersNextAsync(this IApplicationsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListOwnersNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + } } diff --git a/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/DeletedApplicationsOperations.cs b/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/DeletedApplicationsOperations.cs new file mode 100644 index 000000000000..691591437f7b --- /dev/null +++ b/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/DeletedApplicationsOperations.cs @@ -0,0 +1,760 @@ +// +// 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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Graph.RBAC +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// DeletedApplicationsOperations operations. + /// + internal partial class DeletedApplicationsOperations : IServiceOperations, IDeletedApplicationsOperations + { + /// + /// Initializes a new instance of the DeletedApplicationsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal DeletedApplicationsOperations(GraphRbacManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the GraphRbacManagementClient + /// + public GraphRbacManagementClient Client { get; private set; } + + /// + /// Restores the deleted application in the directory. + /// + /// + /// Application object ID. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> RestoreWithHttpMessagesAsync(string objectId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (objectId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "objectId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.TenantID == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.TenantID"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("objectId", objectId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Restore", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{tenantID}/deletedApplications/{objectId}/restore").ToString(); + _url = _url.Replace("{objectId}", System.Uri.EscapeDataString(objectId)); + _url = _url.Replace("{tenantID}", System.Uri.EscapeDataString(Client.TenantID)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new GraphErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + GraphError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets a list of deleted applications in the directory. + /// + /// + /// The filter to apply to the operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListWithHttpMessagesAsync(string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.TenantID == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.TenantID"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("filter", filter); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{tenantID}/deletedApplications").ToString(); + _url = _url.Replace("{tenantID}", System.Uri.EscapeDataString(Client.TenantID)); + List _queryParameters = new List(); + if (filter != null) + { + _queryParameters.Add(string.Format("$filter={0}", System.Uri.EscapeDataString(filter))); + } + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new GraphErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + GraphError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Hard-delete an application. + /// + /// + /// Application object ID. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task HardDeleteWithHttpMessagesAsync(string applicationObjectId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (applicationObjectId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "applicationObjectId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.TenantID == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.TenantID"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("applicationObjectId", applicationObjectId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "HardDelete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{tenantID}/deletedApplications/{applicationObjectId}").ToString(); + _url = _url.Replace("{applicationObjectId}", System.Uri.EscapeDataString(applicationObjectId)); + _url = _url.Replace("{tenantID}", System.Uri.EscapeDataString(Client.TenantID)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 204) + { + var ex = new GraphErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + GraphError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets a list of deleted applications in the directory. + /// + /// + /// Next link for the list operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListNextWithHttpMessagesAsync(string nextLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextLink"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.TenantID == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.TenantID"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextLink", nextLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{tenantID}/{nextLink}").ToString(); + _url = _url.Replace("{nextLink}", nextLink); + _url = _url.Replace("{tenantID}", System.Uri.EscapeDataString(Client.TenantID)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new GraphErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + GraphError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/DeletedApplicationsOperationsExtensions.cs b/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/DeletedApplicationsOperationsExtensions.cs new file mode 100644 index 000000000000..d834c0fd2d59 --- /dev/null +++ b/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/DeletedApplicationsOperationsExtensions.cs @@ -0,0 +1,158 @@ +// +// 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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Graph.RBAC +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for DeletedApplicationsOperations. + /// + public static partial class DeletedApplicationsOperationsExtensions + { + /// + /// Restores the deleted application in the directory. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Application object ID. + /// + public static Application Restore(this IDeletedApplicationsOperations operations, string objectId) + { + return operations.RestoreAsync(objectId).GetAwaiter().GetResult(); + } + + /// + /// Restores the deleted application in the directory. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Application object ID. + /// + /// + /// The cancellation token. + /// + public static async Task RestoreAsync(this IDeletedApplicationsOperations operations, string objectId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.RestoreWithHttpMessagesAsync(objectId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a list of deleted applications in the directory. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The filter to apply to the operation. + /// + public static IPage List(this IDeletedApplicationsOperations operations, string filter = default(string)) + { + return operations.ListAsync(filter).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of deleted applications in the directory. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The filter to apply to the operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IDeletedApplicationsOperations operations, string filter = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(filter, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Hard-delete an application. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Application object ID. + /// + public static void HardDelete(this IDeletedApplicationsOperations operations, string applicationObjectId) + { + operations.HardDeleteAsync(applicationObjectId).GetAwaiter().GetResult(); + } + + /// + /// Hard-delete an application. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Application object ID. + /// + /// + /// The cancellation token. + /// + public static async Task HardDeleteAsync(this IDeletedApplicationsOperations operations, string applicationObjectId, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.HardDeleteWithHttpMessagesAsync(applicationObjectId, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Gets a list of deleted applications in the directory. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Next link for the list operation. + /// + public static IPage ListNext(this IDeletedApplicationsOperations operations, string nextLink) + { + return operations.ListNextAsync(nextLink).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of deleted applications in the directory. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Next link for the list operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListNextAsync(this IDeletedApplicationsOperations operations, string nextLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/GraphRbacManagementClient.cs b/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/GraphRbacManagementClient.cs index bde81dab5004..62721dc992ac 100644 --- a/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/GraphRbacManagementClient.cs +++ b/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/GraphRbacManagementClient.cs @@ -75,15 +75,20 @@ public partial class GraphRbacManagementClient : ServiceClient - /// Gets the IObjectsOperations. + /// Gets the ISignedInUserOperations. /// - public virtual IObjectsOperations Objects { get; private set; } + public virtual ISignedInUserOperations SignedInUser { get; private set; } /// /// Gets the IApplicationsOperations. /// public virtual IApplicationsOperations Applications { get; private set; } + /// + /// Gets the IDeletedApplicationsOperations. + /// + public virtual IDeletedApplicationsOperations DeletedApplications { get; private set; } + /// /// Gets the IGroupsOperations. /// @@ -99,6 +104,11 @@ public partial class GraphRbacManagementClient : ServiceClient public virtual IUsersOperations Users { get; private set; } + /// + /// Gets the IObjectsOperations. + /// + public virtual IObjectsOperations Objects { get; private set; } + /// /// Gets the IDomainsOperations. /// @@ -350,11 +360,13 @@ public GraphRbacManagementClient(System.Uri baseUri, ServiceClientCredentials cr /// private void Initialize() { - Objects = new ObjectsOperations(this); + SignedInUser = new SignedInUserOperations(this); Applications = new ApplicationsOperations(this); + DeletedApplications = new DeletedApplicationsOperations(this); Groups = new GroupsOperations(this); ServicePrincipals = new ServicePrincipalsOperations(this); Users = new UsersOperations(this); + Objects = new ObjectsOperations(this); Domains = new DomainsOperations(this); OAuth2 = new OAuth2Operations(this); BaseUri = new System.Uri("https://graph.windows.net"); diff --git a/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/GroupsOperations.cs b/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/GroupsOperations.cs index 054504ebe328..5bdb11f804e1 100644 --- a/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/GroupsOperations.cs +++ b/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/GroupsOperations.cs @@ -996,7 +996,7 @@ internal GroupsOperations(GraphRbacManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> GetGroupMembersWithHttpMessagesAsync(string objectId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> GetGroupMembersWithHttpMessagesAsync(string objectId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (objectId == null) { @@ -1119,7 +1119,7 @@ internal GroupsOperations(GraphRbacManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -1132,7 +1132,7 @@ internal GroupsOperations(GraphRbacManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -1695,6 +1695,542 @@ internal GroupsOperations(GraphRbacManagementClient client) return _result; } + /// + /// Directory objects that are owners of the group. + /// + /// + /// The owners are a set of non-admin users who are allowed to modify this + /// object. + /// + /// + /// The object ID of the group for which to get owners. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListOwnersWithHttpMessagesAsync(string objectId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (objectId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "objectId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.TenantID == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.TenantID"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("objectId", objectId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListOwners", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{tenantID}/groups/{objectId}/owners").ToString(); + _url = _url.Replace("{objectId}", System.Uri.EscapeDataString(objectId)); + _url = _url.Replace("{tenantID}", System.Uri.EscapeDataString(Client.TenantID)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new GraphErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + GraphError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Add an owner to a group. + /// + /// + /// The object ID of the application to which to add the owner. + /// + /// + /// The URL of the owner object, such as + /// https://graph.windows.net/0b1f9851-1bf0-433f-aec3-cb9272f093dc/directoryObjects/f260bbc4-c254-447b-94cf-293b5ec434dd. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task AddOwnerWithHttpMessagesAsync(string objectId, AddOwnerParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (objectId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "objectId"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (parameters != null) + { + parameters.Validate(); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.TenantID == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.TenantID"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("objectId", objectId); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "AddOwner", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{tenantID}/groups/{objectId}/$links/owners").ToString(); + _url = _url.Replace("{objectId}", System.Uri.EscapeDataString(objectId)); + _url = _url.Replace("{tenantID}", System.Uri.EscapeDataString(Client.TenantID)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 204) + { + var ex = new GraphErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + GraphError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Remove a member from owners. + /// + /// + /// The object ID of the group from which to remove the owner. + /// + /// + /// Owner object id + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task RemoveOwnerWithHttpMessagesAsync(string objectId, string ownerObjectId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (objectId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "objectId"); + } + if (ownerObjectId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ownerObjectId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.TenantID == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.TenantID"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("objectId", objectId); + tracingParameters.Add("ownerObjectId", ownerObjectId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "RemoveOwner", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{tenantID}/groups/{objectId}/$links/owners/{ownerObjectId}").ToString(); + _url = _url.Replace("{objectId}", System.Uri.EscapeDataString(objectId)); + _url = _url.Replace("{ownerObjectId}", System.Uri.EscapeDataString(ownerObjectId)); + _url = _url.Replace("{tenantID}", System.Uri.EscapeDataString(Client.TenantID)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 204) + { + var ex = new GraphErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + GraphError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + /// /// Gets a list of groups for the current tenant. /// @@ -1904,7 +2440,7 @@ internal GroupsOperations(GraphRbacManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> GetGroupMembersNextWithHttpMessagesAsync(string nextLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> GetGroupMembersNextWithHttpMessagesAsync(string nextLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (nextLink == null) { @@ -2027,7 +2563,179 @@ internal GroupsOperations(GraphRbacManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Directory objects that are owners of the group. + /// + /// + /// The owners are a set of non-admin users who are allowed to modify this + /// object. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListOwnersNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListOwnersNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new GraphErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + GraphError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -2040,7 +2748,7 @@ internal GroupsOperations(GraphRbacManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { diff --git a/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/GroupsOperationsExtensions.cs b/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/GroupsOperationsExtensions.cs index 4d1639765e86..31ff9e83a1f7 100644 --- a/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/GroupsOperationsExtensions.cs +++ b/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/GroupsOperationsExtensions.cs @@ -213,7 +213,7 @@ public static ADGroup Create(this IGroupsOperations operations, GroupCreateParam /// /// The object ID of the group whose members should be retrieved. /// - public static IPage GetGroupMembers(this IGroupsOperations operations, string objectId) + public static IPage GetGroupMembers(this IGroupsOperations operations, string objectId) { return operations.GetGroupMembersAsync(objectId).GetAwaiter().GetResult(); } @@ -230,7 +230,7 @@ public static IPage GetGroupMembers(this IGroupsOperations operations /// /// The cancellation token. /// - public static async Task> GetGroupMembersAsync(this IGroupsOperations operations, string objectId, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> GetGroupMembersAsync(this IGroupsOperations operations, string objectId, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetGroupMembersWithHttpMessagesAsync(objectId, null, cancellationToken).ConfigureAwait(false)) { @@ -345,6 +345,124 @@ public static IEnumerable GetMemberGroups(this IGroupsOperations operati } } + /// + /// Directory objects that are owners of the group. + /// + /// + /// The owners are a set of non-admin users who are allowed to modify this + /// object. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The object ID of the group for which to get owners. + /// + public static IPage ListOwners(this IGroupsOperations operations, string objectId) + { + return operations.ListOwnersAsync(objectId).GetAwaiter().GetResult(); + } + + /// + /// Directory objects that are owners of the group. + /// + /// + /// The owners are a set of non-admin users who are allowed to modify this + /// object. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The object ID of the group for which to get owners. + /// + /// + /// The cancellation token. + /// + public static async Task> ListOwnersAsync(this IGroupsOperations operations, string objectId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListOwnersWithHttpMessagesAsync(objectId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Add an owner to a group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The object ID of the application to which to add the owner. + /// + /// + /// The URL of the owner object, such as + /// https://graph.windows.net/0b1f9851-1bf0-433f-aec3-cb9272f093dc/directoryObjects/f260bbc4-c254-447b-94cf-293b5ec434dd. + /// + public static void AddOwner(this IGroupsOperations operations, string objectId, AddOwnerParameters parameters) + { + operations.AddOwnerAsync(objectId, parameters).GetAwaiter().GetResult(); + } + + /// + /// Add an owner to a group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The object ID of the application to which to add the owner. + /// + /// + /// The URL of the owner object, such as + /// https://graph.windows.net/0b1f9851-1bf0-433f-aec3-cb9272f093dc/directoryObjects/f260bbc4-c254-447b-94cf-293b5ec434dd. + /// + /// + /// The cancellation token. + /// + public static async Task AddOwnerAsync(this IGroupsOperations operations, string objectId, AddOwnerParameters parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.AddOwnerWithHttpMessagesAsync(objectId, parameters, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Remove a member from owners. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The object ID of the group from which to remove the owner. + /// + /// + /// Owner object id + /// + public static void RemoveOwner(this IGroupsOperations operations, string objectId, string ownerObjectId) + { + operations.RemoveOwnerAsync(objectId, ownerObjectId).GetAwaiter().GetResult(); + } + + /// + /// Remove a member from owners. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The object ID of the group from which to remove the owner. + /// + /// + /// Owner object id + /// + /// + /// The cancellation token. + /// + public static async Task RemoveOwnerAsync(this IGroupsOperations operations, string objectId, string ownerObjectId, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.RemoveOwnerWithHttpMessagesAsync(objectId, ownerObjectId, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// /// Gets a list of groups for the current tenant. /// @@ -388,7 +506,7 @@ public static IPage ListNext(this IGroupsOperations operations, string /// /// Next link for the list operation. /// - public static IPage GetGroupMembersNext(this IGroupsOperations operations, string nextLink) + public static IPage GetGroupMembersNext(this IGroupsOperations operations, string nextLink) { return operations.GetGroupMembersNextAsync(nextLink).GetAwaiter().GetResult(); } @@ -405,7 +523,7 @@ public static IPage GetGroupMembersNext(this IGroupsOperations operat /// /// The cancellation token. /// - public static async Task> GetGroupMembersNextAsync(this IGroupsOperations operations, string nextLink, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> GetGroupMembersNextAsync(this IGroupsOperations operations, string nextLink, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetGroupMembersNextWithHttpMessagesAsync(nextLink, null, cancellationToken).ConfigureAwait(false)) { @@ -413,5 +531,47 @@ public static IPage GetGroupMembersNext(this IGroupsOperations operat } } + /// + /// Directory objects that are owners of the group. + /// + /// + /// The owners are a set of non-admin users who are allowed to modify this + /// object. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListOwnersNext(this IGroupsOperations operations, string nextPageLink) + { + return operations.ListOwnersNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Directory objects that are owners of the group. + /// + /// + /// The owners are a set of non-admin users who are allowed to modify this + /// object. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListOwnersNextAsync(this IGroupsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListOwnersNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + } } diff --git a/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/IApplicationsOperations.cs b/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/IApplicationsOperations.cs index 687e891cf35b..e803d41498b7 100644 --- a/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/IApplicationsOperations.cs +++ b/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/IApplicationsOperations.cs @@ -156,7 +156,7 @@ public partial interface IApplicationsOperations /// /// Thrown when a required parameter is null /// - Task>> ListOwnersWithHttpMessagesAsync(string applicationObjectId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListOwnersWithHttpMessagesAsync(string applicationObjectId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Add an owner to an application. /// @@ -179,7 +179,29 @@ public partial interface IApplicationsOperations /// /// Thrown when a required parameter is null /// - Task AddOwnerWithHttpMessagesAsync(string applicationObjectId, ApplicationAddOwnerParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task AddOwnerWithHttpMessagesAsync(string applicationObjectId, AddOwnerParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Remove a member from owners. + /// + /// + /// The object ID of the application from which to remove the owner. + /// + /// + /// Owner object id + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task RemoveOwnerWithHttpMessagesAsync(string applicationObjectId, string ownerObjectId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Get the keyCredentials associated with an application. /// @@ -291,5 +313,31 @@ public partial interface IApplicationsOperations /// Thrown when a required parameter is null /// Task>> ListNextWithHttpMessagesAsync(string nextLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Directory objects that are owners of the application. + /// + /// + /// The owners are a set of non-admin users who are allowed to modify + /// this object. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListOwnersNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/IDeletedApplicationsOperations.cs b/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/IDeletedApplicationsOperations.cs new file mode 100644 index 000000000000..7cd37af9cf32 --- /dev/null +++ b/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/IDeletedApplicationsOperations.cs @@ -0,0 +1,112 @@ +// +// 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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Graph.RBAC +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// DeletedApplicationsOperations operations. + /// + public partial interface IDeletedApplicationsOperations + { + /// + /// Restores the deleted application in the directory. + /// + /// + /// Application object ID. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> RestoreWithHttpMessagesAsync(string objectId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a list of deleted applications in the directory. + /// + /// + /// The filter to apply to the operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListWithHttpMessagesAsync(string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Hard-delete an application. + /// + /// + /// Application object ID. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task HardDeleteWithHttpMessagesAsync(string applicationObjectId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a list of deleted applications in the directory. + /// + /// + /// Next link for the list operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListNextWithHttpMessagesAsync(string nextLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/IGraphRbacManagementClient.cs b/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/IGraphRbacManagementClient.cs index 0113e0bf71e4..304c21545be4 100644 --- a/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/IGraphRbacManagementClient.cs +++ b/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/IGraphRbacManagementClient.cs @@ -70,15 +70,20 @@ public partial interface IGraphRbacManagementClient : System.IDisposable /// - /// Gets the IObjectsOperations. + /// Gets the ISignedInUserOperations. /// - IObjectsOperations Objects { get; } + ISignedInUserOperations SignedInUser { get; } /// /// Gets the IApplicationsOperations. /// IApplicationsOperations Applications { get; } + /// + /// Gets the IDeletedApplicationsOperations. + /// + IDeletedApplicationsOperations DeletedApplications { get; } + /// /// Gets the IGroupsOperations. /// @@ -94,6 +99,11 @@ public partial interface IGraphRbacManagementClient : System.IDisposable /// IUsersOperations Users { get; } + /// + /// Gets the IObjectsOperations. + /// + IObjectsOperations Objects { get; } + /// /// Gets the IDomainsOperations. /// diff --git a/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/IGroupsOperations.cs b/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/IGroupsOperations.cs index 38b48f20fed1..0dc24ce826f1 100644 --- a/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/IGroupsOperations.cs +++ b/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/IGroupsOperations.cs @@ -157,7 +157,7 @@ public partial interface IGroupsOperations /// /// Thrown when a required parameter is null /// - Task>> GetGroupMembersWithHttpMessagesAsync(string objectId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> GetGroupMembersWithHttpMessagesAsync(string objectId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets group information from the directory. /// @@ -226,6 +226,77 @@ public partial interface IGroupsOperations /// Task>> GetMemberGroupsWithHttpMessagesAsync(string objectId, GroupGetMemberGroupsParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// + /// Directory objects that are owners of the group. + /// + /// + /// The owners are a set of non-admin users who are allowed to modify + /// this object. + /// + /// + /// The object ID of the group for which to get owners. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListOwnersWithHttpMessagesAsync(string objectId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Add an owner to a group. + /// + /// + /// The object ID of the application to which to add the owner. + /// + /// + /// The URL of the owner object, such as + /// https://graph.windows.net/0b1f9851-1bf0-433f-aec3-cb9272f093dc/directoryObjects/f260bbc4-c254-447b-94cf-293b5ec434dd. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task AddOwnerWithHttpMessagesAsync(string objectId, AddOwnerParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Remove a member from owners. + /// + /// + /// The object ID of the group from which to remove the owner. + /// + /// + /// Owner object id + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task RemoveOwnerWithHttpMessagesAsync(string objectId, string ownerObjectId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// /// Gets a list of groups for the current tenant. /// /// @@ -268,6 +339,32 @@ public partial interface IGroupsOperations /// /// Thrown when a required parameter is null /// - Task>> GetGroupMembersNextWithHttpMessagesAsync(string nextLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> GetGroupMembersNextWithHttpMessagesAsync(string nextLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Directory objects that are owners of the group. + /// + /// + /// The owners are a set of non-admin users who are allowed to modify + /// this object. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListOwnersNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/IOAuth2Operations.cs b/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/IOAuth2Operations.cs index b922c67fd5cb..8e032b10e73d 100644 --- a/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/IOAuth2Operations.cs +++ b/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/IOAuth2Operations.cs @@ -24,7 +24,8 @@ namespace Microsoft.Azure.Graph.RBAC public partial interface IOAuth2Operations { /// - /// Queries OAuth2 permissions for the relevant SP ObjectId of an app. + /// Queries OAuth2 permissions grants for the relevant SP ObjectId of + /// an app. /// /// /// This is the Service Principal ObjectId associated with the app @@ -44,13 +45,13 @@ public partial interface IOAuth2Operations /// /// Thrown when a required parameter is null /// - Task> GetWithHttpMessagesAsync(string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> GetWithHttpMessagesAsync(string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Grants OAuth2 permissions for the relevant resource Ids of an app. /// /// /// The relevant app Service Principal Object Id and the Service - /// Principal Objecit Id you want to grant. + /// Principal Object Id you want to grant. /// /// /// The headers that will be added to request. @@ -67,6 +68,49 @@ public partial interface IOAuth2Operations /// /// Thrown when a required parameter is null /// - Task> PostWithHttpMessagesAsync(Permissions body = default(Permissions), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> GrantWithHttpMessagesAsync(Permissions body = default(Permissions), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete a OAuth2 permission grant for the relevant resource Ids of + /// an app. + /// + /// + /// The object ID of a permission grant. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteWithHttpMessagesAsync(string objectId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Queries OAuth2 permissions grants for the relevant SP ObjectId of + /// an app. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> GetNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/IObjectsOperations.cs b/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/IObjectsOperations.cs index f7518e68248b..ae6619ae5d51 100644 --- a/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/IObjectsOperations.cs +++ b/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/IObjectsOperations.cs @@ -24,26 +24,9 @@ namespace Microsoft.Azure.Graph.RBAC public partial interface IObjectsOperations { /// - /// Gets the details for the currently logged-in user. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - Task> GetCurrentUserWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Gets AD group membership for the specified AD object IDs. + /// Gets the directory objects specified in a list of object IDs. You + /// can also specify which resource collections (users, groups, etc.) + /// should be searched by specifying the optional types parameter. /// /// /// Objects filtering parameters. @@ -63,7 +46,7 @@ public partial interface IObjectsOperations /// /// Thrown when a required parameter is null /// - Task>> GetObjectsByObjectIdsWithHttpMessagesAsync(GetObjectsParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> GetObjectsByObjectIdsWithHttpMessagesAsync(GetObjectsParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets AD group membership for the specified AD object IDs. /// @@ -85,6 +68,6 @@ public partial interface IObjectsOperations /// /// Thrown when a required parameter is null /// - Task>> GetObjectsByObjectIdsNextWithHttpMessagesAsync(string nextLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> GetObjectsByObjectIdsNextWithHttpMessagesAsync(string nextLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/IServicePrincipalsOperations.cs b/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/IServicePrincipalsOperations.cs index 20ca1efe753d..4e4ff5b7b5e8 100644 --- a/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/IServicePrincipalsOperations.cs +++ b/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/IServicePrincipalsOperations.cs @@ -69,6 +69,28 @@ public partial interface IServicePrincipalsOperations /// Task>> ListWithHttpMessagesAsync(ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// + /// Updates a service principal in the directory. + /// + /// + /// The object ID of the service principal to delete. + /// + /// + /// Parameters to update a service principal. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task UpdateWithHttpMessagesAsync(string objectId, ServicePrincipalUpdateParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// /// Deletes a service principal from the directory. /// /// @@ -135,7 +157,7 @@ public partial interface IServicePrincipalsOperations /// /// Thrown when a required parameter is null /// - Task>> ListOwnersWithHttpMessagesAsync(string objectId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListOwnersWithHttpMessagesAsync(string objectId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Get the keyCredentials associated with the specified service /// principal. @@ -251,5 +273,31 @@ public partial interface IServicePrincipalsOperations /// Thrown when a required parameter is null /// Task>> ListNextWithHttpMessagesAsync(string nextLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// 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. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListOwnersNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/ISignedInUserOperations.cs b/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/ISignedInUserOperations.cs new file mode 100644 index 000000000000..f1e841e0f970 --- /dev/null +++ b/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/ISignedInUserOperations.cs @@ -0,0 +1,87 @@ +// +// 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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Graph.RBAC +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// SignedInUserOperations operations. + /// + public partial interface ISignedInUserOperations + { + /// + /// Gets the details for the currently logged-in user. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get the list of directory objects that are owned by the user. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListOwnedObjectsWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get the list of directory objects that are owned by the user. + /// + /// + /// Next link for the list operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListOwnedObjectsNextWithHttpMessagesAsync(string nextLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/Models/AADObject.cs b/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/Models/AADObject.cs deleted file mode 100644 index 6fff9f0e0d3a..000000000000 --- a/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/Models/AADObject.cs +++ /dev/null @@ -1,213 +0,0 @@ -// -// 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. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Graph.RBAC.Models -{ - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// The properties of an Active Directory object. - /// - public partial class AADObject - { - /// - /// Initializes a new instance of the AADObject class. - /// - public AADObject() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the AADObject class. - /// - /// Unmatched properties from the - /// message are deserialized this collection - /// The ID of the object. - /// The type of AAD object. - /// The display name of the object. - /// The principal name of the - /// object. - /// The primary email address of the object. - /// Whether the AAD object is - /// mail-enabled. - /// The mail alias for the user. - /// Whether the AAD object is - /// security-enabled. - /// The sign-in name of the object. - /// A collection of service - /// principal names associated with the object. - /// The user type of the object. - /// 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". - /// The application ID. - /// The application permissions. - /// Whether the application is be - /// available to other tenants. - /// A collection of URIs for the - /// application. - /// A collection of reply URLs for the - /// application. - /// The home page of the application. - public AADObject(IDictionary additionalProperties = default(IDictionary), string objectId = default(string), string objectType = default(string), string displayName = default(string), string userPrincipalName = default(string), string mail = default(string), bool? mailEnabled = default(bool?), string mailNickname = default(string), bool? securityEnabled = default(bool?), string signInName = default(string), IList servicePrincipalNames = default(IList), string userType = default(string), string usageLocation = default(string), string appId = default(string), IList appPermissions = default(IList), bool? availableToOtherTenants = default(bool?), IList identifierUris = default(IList), IList replyUrls = default(IList), string homepage = default(string)) - { - AdditionalProperties = additionalProperties; - ObjectId = objectId; - ObjectType = objectType; - DisplayName = displayName; - UserPrincipalName = userPrincipalName; - Mail = mail; - MailEnabled = mailEnabled; - MailNickname = mailNickname; - SecurityEnabled = securityEnabled; - SignInName = signInName; - ServicePrincipalNames = servicePrincipalNames; - UserType = userType; - UsageLocation = usageLocation; - AppId = appId; - AppPermissions = appPermissions; - AvailableToOtherTenants = availableToOtherTenants; - IdentifierUris = identifierUris; - ReplyUrls = replyUrls; - Homepage = homepage; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets unmatched properties from the message are deserialized - /// this collection - /// - [JsonExtensionData] - public IDictionary AdditionalProperties { get; set; } - - /// - /// Gets or sets the ID of the object. - /// - [JsonProperty(PropertyName = "objectId")] - public string ObjectId { get; set; } - - /// - /// Gets or sets the type of AAD object. - /// - [JsonProperty(PropertyName = "objectType")] - public string ObjectType { get; set; } - - /// - /// Gets or sets the display name of the object. - /// - [JsonProperty(PropertyName = "displayName")] - public string DisplayName { get; set; } - - /// - /// Gets or sets the principal name of the object. - /// - [JsonProperty(PropertyName = "userPrincipalName")] - public string UserPrincipalName { get; set; } - - /// - /// Gets or sets the primary email address of the object. - /// - [JsonProperty(PropertyName = "mail")] - public string Mail { get; set; } - - /// - /// Gets or sets whether the AAD object is mail-enabled. - /// - [JsonProperty(PropertyName = "mailEnabled")] - public bool? MailEnabled { get; set; } - - /// - /// Gets the mail alias for the user. - /// - [JsonProperty(PropertyName = "mailNickname")] - public string MailNickname { get; private set; } - - /// - /// Gets or sets whether the AAD object is security-enabled. - /// - [JsonProperty(PropertyName = "securityEnabled")] - public bool? SecurityEnabled { get; set; } - - /// - /// Gets or sets the sign-in name of the object. - /// - [JsonProperty(PropertyName = "signInName")] - public string SignInName { get; set; } - - /// - /// Gets or sets a collection of service principal names associated - /// with the object. - /// - [JsonProperty(PropertyName = "servicePrincipalNames")] - public IList ServicePrincipalNames { get; set; } - - /// - /// Gets or sets the user type of the object. - /// - [JsonProperty(PropertyName = "userType")] - public string UserType { get; set; } - - /// - /// Gets 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(PropertyName = "usageLocation")] - public string UsageLocation { get; private set; } - - /// - /// Gets the application ID. - /// - [JsonProperty(PropertyName = "appId")] - public string AppId { get; private set; } - - /// - /// Gets the application permissions. - /// - [JsonProperty(PropertyName = "appPermissions")] - public IList AppPermissions { get; private set; } - - /// - /// Gets whether the application is be available to other tenants. - /// - [JsonProperty(PropertyName = "availableToOtherTenants")] - public bool? AvailableToOtherTenants { get; private set; } - - /// - /// Gets a collection of URIs for the application. - /// - [JsonProperty(PropertyName = "identifierUris")] - public IList IdentifierUris { get; private set; } - - /// - /// Gets a collection of reply URLs for the application. - /// - [JsonProperty(PropertyName = "replyUrls")] - public IList ReplyUrls { get; private set; } - - /// - /// Gets the home page of the application. - /// - [JsonProperty(PropertyName = "homepage")] - public string Homepage { get; private set; } - - } -} diff --git a/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/Models/ADGroup.cs b/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/Models/ADGroup.cs index 7f8831d6a221..2970e0d37ecd 100644 --- a/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/Models/ADGroup.cs +++ b/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/Models/ADGroup.cs @@ -38,13 +38,19 @@ public ADGroup() /// The time at which the directory /// object was deleted. /// The display name of the group. + /// Whether the group is mail-enabled. Must + /// be false. This is because only pure security groups can be created + /// using the Graph API. + /// The mail alias for the group. /// Whether the group is /// security-enable. /// The primary email address of the group. - public ADGroup(IDictionary additionalProperties = default(IDictionary), string objectId = default(string), System.DateTime? deletionTimestamp = default(System.DateTime?), string displayName = default(string), bool? securityEnabled = default(bool?), string mail = default(string)) + public ADGroup(IDictionary additionalProperties = default(IDictionary), string objectId = default(string), System.DateTime? deletionTimestamp = default(System.DateTime?), string displayName = default(string), bool? mailEnabled = default(bool?), string mailNickname = default(string), bool? securityEnabled = default(bool?), string mail = default(string)) : base(additionalProperties, objectId, deletionTimestamp) { DisplayName = displayName; + MailEnabled = mailEnabled; + MailNickname = mailNickname; SecurityEnabled = securityEnabled; Mail = mail; CustomInit(); @@ -61,6 +67,20 @@ public ADGroup() [JsonProperty(PropertyName = "displayName")] public string DisplayName { get; set; } + /// + /// Gets or sets whether the group is mail-enabled. Must be false. This + /// is because only pure security groups can be created using the Graph + /// API. + /// + [JsonProperty(PropertyName = "mailEnabled")] + public bool? MailEnabled { get; set; } + + /// + /// Gets or sets the mail alias for the group. + /// + [JsonProperty(PropertyName = "mailNickname")] + public string MailNickname { get; set; } + /// /// Gets or sets whether the group is security-enable. /// diff --git a/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/Models/ApplicationAddOwnerParameters.cs b/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/Models/AddOwnerParameters.cs similarity index 86% rename from src/SDKs/Graph.RBAC/Graph.RBAC/Generated/Models/ApplicationAddOwnerParameters.cs rename to src/SDKs/Graph.RBAC/Graph.RBAC/Generated/Models/AddOwnerParameters.cs index 778d701efd74..9b366a6943db 100644 --- a/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/Models/ApplicationAddOwnerParameters.cs +++ b/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/Models/AddOwnerParameters.cs @@ -19,20 +19,18 @@ namespace Microsoft.Azure.Graph.RBAC.Models /// /// Request parameters for adding a owner to an application. /// - public partial class ApplicationAddOwnerParameters + public partial class AddOwnerParameters { /// - /// Initializes a new instance of the ApplicationAddOwnerParameters - /// class. + /// Initializes a new instance of the AddOwnerParameters class. /// - public ApplicationAddOwnerParameters() + public AddOwnerParameters() { CustomInit(); } /// - /// Initializes a new instance of the ApplicationAddOwnerParameters - /// class. + /// Initializes a new instance of the AddOwnerParameters class. /// /// A owner object URL, such as /// "https://graph.windows.net/0b1f9851-1bf0-433f-aec3-cb9272f093dc/directoryObjects/f260bbc4-c254-447b-94cf-293b5ec434dd", @@ -41,7 +39,7 @@ public ApplicationAddOwnerParameters() /// (user, application, servicePrincipal, group) to be added. /// Unmatched properties from the /// message are deserialized this collection - public ApplicationAddOwnerParameters(string url, IDictionary additionalProperties = default(IDictionary)) + public AddOwnerParameters(string url, IDictionary additionalProperties = default(IDictionary)) { AdditionalProperties = additionalProperties; Url = url; diff --git a/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/Models/AppRole.cs b/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/Models/AppRole.cs new file mode 100644 index 000000000000..c09ebae0515b --- /dev/null +++ b/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/Models/AppRole.cs @@ -0,0 +1,112 @@ +// +// 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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Graph.RBAC.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + public partial class AppRole + { + /// + /// Initializes a new instance of the AppRole class. + /// + public AppRole() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AppRole class. + /// + /// Unique role identifier inside the appRoles + /// collection. + /// Specifies whether this app role + /// definition can be assigned to users and groups by setting to + /// 'User', or to other applications (that are accessing this + /// application in daemon service scenarios) by setting to + /// 'Application', or to both. + /// Permission help text that appears in the + /// admin app assignment and consent experiences. + /// Display name for the permission that + /// appears in the admin consent and app assignment + /// experiences. + /// When creating or updating a role + /// definition, this must be set to true (which is the default). To + /// delete a role, this must first be set to false. At that point, in a + /// subsequent call, this role may be removed. + /// Specifies the value of the roles claim that the + /// application should expect in the authentication and access + /// tokens. + public AppRole(string id = default(string), IList allowedMemberTypes = default(IList), string description = default(string), string displayName = default(string), bool? isEnabled = default(bool?), string value = default(string)) + { + Id = id; + AllowedMemberTypes = allowedMemberTypes; + Description = description; + DisplayName = displayName; + IsEnabled = isEnabled; + Value = value; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets unique role identifier inside the appRoles collection. + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; set; } + + /// + /// Gets or sets specifies whether this app role definition can be + /// assigned to users and groups by setting to 'User', or to other + /// applications (that are accessing this application in daemon service + /// scenarios) by setting to 'Application', or to both. + /// + [JsonProperty(PropertyName = "allowedMemberTypes")] + public IList AllowedMemberTypes { get; set; } + + /// + /// Gets or sets permission help text that appears in the admin app + /// assignment and consent experiences. + /// + [JsonProperty(PropertyName = "description")] + public string Description { get; set; } + + /// + /// Gets or sets display name for the permission that appears in the + /// admin consent and app assignment experiences. + /// + [JsonProperty(PropertyName = "displayName")] + public string DisplayName { get; set; } + + /// + /// Gets or sets when creating or updating a role definition, this must + /// be set to true (which is the default). To delete a role, this must + /// first be set to false. At that point, in a subsequent call, this + /// role may be removed. + /// + [JsonProperty(PropertyName = "isEnabled")] + public bool? IsEnabled { get; set; } + + /// + /// Gets or sets specifies the value of the roles claim that the + /// application should expect in the authentication and access tokens. + /// + [JsonProperty(PropertyName = "value")] + public string Value { get; set; } + + } +} diff --git a/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/Models/Application.cs b/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/Models/Application.cs index 762b4fa22c24..0b880387dd54 100644 --- a/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/Models/Application.cs +++ b/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/Models/Application.cs @@ -37,29 +37,112 @@ public Application() /// The time at which the directory /// object was deleted. /// The application ID. + /// A property on the application to + /// indicate if the application accepts other IDPs or not or partially + /// accepts. + /// Indicates that the application + /// supports pass through users who have no presence in the resource + /// tenant. + /// The url for the application logo image + /// stored in a CDN. + /// The collection of application roles that an + /// application may declare. These roles can be assigned to users, + /// groups or service principals. /// The application permissions. - /// Whether the application is be + /// Whether the application is /// available to other tenants. /// The display name of the /// application. + /// A URL provided by the author of the + /// application to report errors when using the application. + /// The home page of the application. /// A collection of URIs for the /// application. - /// A collection of reply URLs for the + /// urls with more informations of the /// application. - /// The home page of the application. + /// Specifies whether this + /// application supports device authentication without a user. The + /// default is false. + /// A collection of KeyCredential + /// objects. + /// Client applications that are + /// tied to this resource application. Consent to any of the known + /// client applications will result in implicit consent to the resource + /// application through a combined consent dialog (showing the OAuth + /// permission scopes required by the client and the resource). + /// the url of the logout page /// Whether to allow implicit /// grant flow for OAuth2 - public Application(IDictionary additionalProperties = default(IDictionary), string objectId = default(string), System.DateTime? deletionTimestamp = default(System.DateTime?), string appId = default(string), IList appPermissions = default(IList), bool? availableToOtherTenants = default(bool?), string displayName = default(string), IList identifierUris = default(IList), IList replyUrls = default(IList), string homepage = default(string), bool? oauth2AllowImplicitFlow = default(bool?)) + /// Specifies whether during a + /// token Request Azure AD will allow path matching of the redirect URI + /// against the applications collection of replyURLs. The default is + /// false. + /// The collection of OAuth 2.0 + /// permission scopes that the web API (resource) application exposes + /// to client applications. These permission scopes may be granted to + /// client applications during consent. + /// Specifies whether, as part + /// of OAuth 2.0 token requests, Azure AD will allow POST requests, as + /// opposed to GET requests. The default is false, which specifies that + /// only GET requests will be allowed. + /// A list of tenants allowed to access + /// application. + /// A collection of + /// PasswordCredential objects + /// list of pre-authorizaed + /// applications. + /// Specifies whether this application is a + /// public client (such as an installed application running on a mobile + /// device). Default is false. + /// Reliable domain which can be used to + /// identify an application. + /// A collection of reply URLs for the + /// application. + /// 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. + /// The URL to the SAML metadata for the + /// application. + /// Audience for signing in to the + /// application (AzureADMyOrganizatio, AzureADAllorganizations, + /// AzureADAndMicrosofAccounts). + /// The primary Web page. + public Application(IDictionary additionalProperties = default(IDictionary), string objectId = default(string), System.DateTime? deletionTimestamp = default(System.DateTime?), string appId = default(string), bool? allowGuestsSignIn = default(bool?), bool? allowPassthroughUsers = default(bool?), string appLogoUrl = default(string), IList appRoles = default(IList), IList appPermissions = default(IList), bool? availableToOtherTenants = default(bool?), string displayName = default(string), string errorUrl = default(string), string homepage = default(string), IList identifierUris = default(IList), InformationalUrl informationalUrls = default(InformationalUrl), bool? isDeviceOnlyAuthSupported = default(bool?), IList keyCredentials = default(IList), IList knownClientApplications = default(IList), string logoutUrl = default(string), bool? oauth2AllowImplicitFlow = default(bool?), bool? oauth2AllowUrlPathMatching = default(bool?), IList oauth2Permissions = default(IList), bool? oauth2RequirePostResponse = default(bool?), IList orgRestrictions = default(IList), OptionalClaims optionalClaims = default(OptionalClaims), IList passwordCredentials = default(IList), IList preAuthorizedApplications = default(IList), bool? publicClient = default(bool?), string publisherDomain = default(string), IList replyUrls = default(IList), IList requiredResourceAccess = default(IList), string samlMetadataUrl = default(string), string signInAudience = default(string), string wwwHomepage = default(string)) : base(additionalProperties, objectId, deletionTimestamp) { AppId = appId; + AllowGuestsSignIn = allowGuestsSignIn; + AllowPassthroughUsers = allowPassthroughUsers; + AppLogoUrl = appLogoUrl; + AppRoles = appRoles; AppPermissions = appPermissions; AvailableToOtherTenants = availableToOtherTenants; DisplayName = displayName; - IdentifierUris = identifierUris; - ReplyUrls = replyUrls; + ErrorUrl = errorUrl; Homepage = homepage; + IdentifierUris = identifierUris; + InformationalUrls = informationalUrls; + IsDeviceOnlyAuthSupported = isDeviceOnlyAuthSupported; + KeyCredentials = keyCredentials; + KnownClientApplications = knownClientApplications; + LogoutUrl = logoutUrl; Oauth2AllowImplicitFlow = oauth2AllowImplicitFlow; + Oauth2AllowUrlPathMatching = oauth2AllowUrlPathMatching; + Oauth2Permissions = oauth2Permissions; + Oauth2RequirePostResponse = oauth2RequirePostResponse; + OrgRestrictions = orgRestrictions; + OptionalClaims = optionalClaims; + PasswordCredentials = passwordCredentials; + PreAuthorizedApplications = preAuthorizedApplications; + PublicClient = publicClient; + PublisherDomain = publisherDomain; + ReplyUrls = replyUrls; + RequiredResourceAccess = requiredResourceAccess; + SamlMetadataUrl = samlMetadataUrl; + SignInAudience = signInAudience; + WwwHomepage = wwwHomepage; CustomInit(); } @@ -74,6 +157,35 @@ public Application() [JsonProperty(PropertyName = "appId")] public string AppId { get; set; } + /// + /// Gets or sets a property on the application to indicate if the + /// application accepts other IDPs or not or partially accepts. + /// + [JsonProperty(PropertyName = "allowGuestsSignIn")] + public bool? AllowGuestsSignIn { get; set; } + + /// + /// Gets or sets indicates that the application supports pass through + /// users who have no presence in the resource tenant. + /// + [JsonProperty(PropertyName = "allowPassthroughUsers")] + public bool? AllowPassthroughUsers { get; set; } + + /// + /// Gets or sets the url for the application logo image stored in a + /// CDN. + /// + [JsonProperty(PropertyName = "appLogoUrl")] + public string AppLogoUrl { get; set; } + + /// + /// Gets or sets the collection of application roles that an + /// application may declare. These roles can be assigned to users, + /// groups or service principals. + /// + [JsonProperty(PropertyName = "appRoles")] + public IList AppRoles { get; set; } + /// /// Gets or sets the application permissions. /// @@ -81,8 +193,7 @@ public Application() public IList AppPermissions { get; set; } /// - /// Gets or sets whether the application is be available to other - /// tenants. + /// Gets or sets whether the application is available to other tenants. /// [JsonProperty(PropertyName = "availableToOtherTenants")] public bool? AvailableToOtherTenants { get; set; } @@ -93,6 +204,19 @@ public Application() [JsonProperty(PropertyName = "displayName")] public string DisplayName { get; set; } + /// + /// Gets or sets a URL provided by the author of the application to + /// report errors when using the application. + /// + [JsonProperty(PropertyName = "errorUrl")] + public string ErrorUrl { get; set; } + + /// + /// Gets or sets the home page of the application. + /// + [JsonProperty(PropertyName = "homepage")] + public string Homepage { get; set; } + /// /// Gets or sets a collection of URIs for the application. /// @@ -100,16 +224,39 @@ public Application() public IList IdentifierUris { get; set; } /// - /// Gets or sets a collection of reply URLs for the application. + /// Gets or sets urls with more informations of the application. /// - [JsonProperty(PropertyName = "replyUrls")] - public IList ReplyUrls { get; set; } + [JsonProperty(PropertyName = "informationalUrls")] + public InformationalUrl InformationalUrls { get; set; } /// - /// Gets or sets the home page of the application. + /// Gets or sets specifies whether this application supports device + /// authentication without a user. The default is false. /// - [JsonProperty(PropertyName = "homepage")] - public string Homepage { get; set; } + [JsonProperty(PropertyName = "isDeviceOnlyAuthSupported")] + public bool? IsDeviceOnlyAuthSupported { get; set; } + + /// + /// Gets or sets a collection of KeyCredential objects. + /// + [JsonProperty(PropertyName = "keyCredentials")] + public IList KeyCredentials { get; set; } + + /// + /// Gets or sets client applications that are tied to this resource + /// application. Consent to any of the known client applications will + /// result in implicit consent to the resource application through a + /// combined consent dialog (showing the OAuth permission scopes + /// required by the client and the resource). + /// + [JsonProperty(PropertyName = "knownClientApplications")] + public IList KnownClientApplications { get; set; } + + /// + /// Gets or sets the url of the logout page + /// + [JsonProperty(PropertyName = "logoutUrl")] + public string LogoutUrl { get; set; } /// /// Gets or sets whether to allow implicit grant flow for OAuth2 @@ -117,5 +264,105 @@ public Application() [JsonProperty(PropertyName = "oauth2AllowImplicitFlow")] public bool? Oauth2AllowImplicitFlow { get; set; } + /// + /// Gets or sets specifies whether during a token Request Azure AD will + /// allow path matching of the redirect URI against the applications + /// collection of replyURLs. The default is false. + /// + [JsonProperty(PropertyName = "oauth2AllowUrlPathMatching")] + public bool? Oauth2AllowUrlPathMatching { get; set; } + + /// + /// Gets or sets the collection of OAuth 2.0 permission scopes that the + /// web API (resource) application exposes to client applications. + /// These permission scopes may be granted to client applications + /// during consent. + /// + [JsonProperty(PropertyName = "oauth2Permissions")] + public IList Oauth2Permissions { get; set; } + + /// + /// Gets or sets specifies whether, as part of OAuth 2.0 token + /// requests, Azure AD will allow POST requests, as opposed to GET + /// requests. The default is false, which specifies that only GET + /// requests will be allowed. + /// + [JsonProperty(PropertyName = "oauth2RequirePostResponse")] + public bool? Oauth2RequirePostResponse { get; set; } + + /// + /// Gets or sets a list of tenants allowed to access application. + /// + [JsonProperty(PropertyName = "orgRestrictions")] + public IList OrgRestrictions { get; set; } + + /// + /// + [JsonProperty(PropertyName = "optionalClaims")] + public OptionalClaims OptionalClaims { get; set; } + + /// + /// Gets or sets a collection of PasswordCredential objects + /// + [JsonProperty(PropertyName = "passwordCredentials")] + public IList PasswordCredentials { get; set; } + + /// + /// Gets or sets list of pre-authorizaed applications. + /// + [JsonProperty(PropertyName = "preAuthorizedApplications")] + public IList PreAuthorizedApplications { get; set; } + + /// + /// Gets or sets specifies whether this application is a public client + /// (such as an installed application running on a mobile device). + /// Default is false. + /// + [JsonProperty(PropertyName = "publicClient")] + public bool? PublicClient { get; set; } + + /// + /// Gets or sets reliable domain which can be used to identify an + /// application. + /// + [JsonProperty(PropertyName = "publisherDomain")] + public string PublisherDomain { get; set; } + + /// + /// Gets or sets a collection of reply URLs for the application. + /// + [JsonProperty(PropertyName = "replyUrls")] + public IList ReplyUrls { get; set; } + + /// + /// Gets or sets 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(PropertyName = "requiredResourceAccess")] + public IList RequiredResourceAccess { get; set; } + + /// + /// Gets or sets the URL to the SAML metadata for the application. + /// + [JsonProperty(PropertyName = "samlMetadataUrl")] + public string SamlMetadataUrl { get; set; } + + /// + /// Gets or sets audience for signing in to the application + /// (AzureADMyOrganizatio, AzureADAllorganizations, + /// AzureADAndMicrosofAccounts). + /// + [JsonProperty(PropertyName = "signInAudience")] + public string SignInAudience { get; set; } + + /// + /// Gets or sets the primary Web page. + /// + [JsonProperty(PropertyName = "wwwHomepage")] + public string WwwHomepage { get; set; } + } } diff --git a/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/Models/ApplicationBase.cs b/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/Models/ApplicationBase.cs new file mode 100644 index 000000000000..13a600e076a1 --- /dev/null +++ b/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/Models/ApplicationBase.cs @@ -0,0 +1,337 @@ +// +// 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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Graph.RBAC.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Active Directive Application common properties shared among GET, POST + /// and PATCH + /// + public partial class ApplicationBase + { + /// + /// Initializes a new instance of the ApplicationBase class. + /// + public ApplicationBase() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ApplicationBase class. + /// + /// A property on the application to + /// indicate if the application accepts other IDPs or not or partially + /// accepts. + /// Indicates that the application + /// supports pass through users who have no presence in the resource + /// tenant. + /// The url for the application logo image + /// stored in a CDN. + /// The collection of application roles that an + /// application may declare. These roles can be assigned to users, + /// groups or service principals. + /// The application permissions. + /// Whether the application is + /// available to other tenants. + /// A URL provided by the author of the + /// application to report errors when using the application. + /// The home page of the application. + /// urls with more informations of the + /// application. + /// Specifies whether this + /// application supports device authentication without a user. The + /// default is false. + /// A collection of KeyCredential + /// objects. + /// Client applications that are + /// tied to this resource application. Consent to any of the known + /// client applications will result in implicit consent to the resource + /// application through a combined consent dialog (showing the OAuth + /// permission scopes required by the client and the resource). + /// the url of the logout page + /// Whether to allow implicit + /// grant flow for OAuth2 + /// Specifies whether during a + /// token Request Azure AD will allow path matching of the redirect URI + /// against the applications collection of replyURLs. The default is + /// false. + /// The collection of OAuth 2.0 + /// permission scopes that the web API (resource) application exposes + /// to client applications. These permission scopes may be granted to + /// client applications during consent. + /// Specifies whether, as part + /// of OAuth 2.0 token requests, Azure AD will allow POST requests, as + /// opposed to GET requests. The default is false, which specifies that + /// only GET requests will be allowed. + /// A list of tenants allowed to access + /// application. + /// A collection of + /// PasswordCredential objects + /// list of pre-authorizaed + /// applications. + /// Specifies whether this application is a + /// public client (such as an installed application running on a mobile + /// device). Default is false. + /// Reliable domain which can be used to + /// identify an application. + /// A collection of reply URLs for the + /// application. + /// 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. + /// The URL to the SAML metadata for the + /// application. + /// Audience for signing in to the + /// application (AzureADMyOrganizatio, AzureADAllorganizations, + /// AzureADAndMicrosofAccounts). + /// The primary Web page. + public ApplicationBase(bool? allowGuestsSignIn = default(bool?), bool? allowPassthroughUsers = default(bool?), string appLogoUrl = default(string), IList appRoles = default(IList), IList appPermissions = default(IList), bool? availableToOtherTenants = default(bool?), string errorUrl = default(string), string homepage = default(string), InformationalUrl informationalUrls = default(InformationalUrl), bool? isDeviceOnlyAuthSupported = default(bool?), IList keyCredentials = default(IList), IList knownClientApplications = default(IList), string logoutUrl = default(string), bool? oauth2AllowImplicitFlow = default(bool?), bool? oauth2AllowUrlPathMatching = default(bool?), IList oauth2Permissions = default(IList), bool? oauth2RequirePostResponse = default(bool?), IList orgRestrictions = default(IList), OptionalClaims optionalClaims = default(OptionalClaims), IList passwordCredentials = default(IList), IList preAuthorizedApplications = default(IList), bool? publicClient = default(bool?), string publisherDomain = default(string), IList replyUrls = default(IList), IList requiredResourceAccess = default(IList), string samlMetadataUrl = default(string), string signInAudience = default(string), string wwwHomepage = default(string)) + { + AllowGuestsSignIn = allowGuestsSignIn; + AllowPassthroughUsers = allowPassthroughUsers; + AppLogoUrl = appLogoUrl; + AppRoles = appRoles; + AppPermissions = appPermissions; + AvailableToOtherTenants = availableToOtherTenants; + ErrorUrl = errorUrl; + Homepage = homepage; + InformationalUrls = informationalUrls; + IsDeviceOnlyAuthSupported = isDeviceOnlyAuthSupported; + KeyCredentials = keyCredentials; + KnownClientApplications = knownClientApplications; + LogoutUrl = logoutUrl; + Oauth2AllowImplicitFlow = oauth2AllowImplicitFlow; + Oauth2AllowUrlPathMatching = oauth2AllowUrlPathMatching; + Oauth2Permissions = oauth2Permissions; + Oauth2RequirePostResponse = oauth2RequirePostResponse; + OrgRestrictions = orgRestrictions; + OptionalClaims = optionalClaims; + PasswordCredentials = passwordCredentials; + PreAuthorizedApplications = preAuthorizedApplications; + PublicClient = publicClient; + PublisherDomain = publisherDomain; + ReplyUrls = replyUrls; + RequiredResourceAccess = requiredResourceAccess; + SamlMetadataUrl = samlMetadataUrl; + SignInAudience = signInAudience; + WwwHomepage = wwwHomepage; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets a property on the application to indicate if the + /// application accepts other IDPs or not or partially accepts. + /// + [JsonProperty(PropertyName = "allowGuestsSignIn")] + public bool? AllowGuestsSignIn { get; set; } + + /// + /// Gets or sets indicates that the application supports pass through + /// users who have no presence in the resource tenant. + /// + [JsonProperty(PropertyName = "allowPassthroughUsers")] + public bool? AllowPassthroughUsers { get; set; } + + /// + /// Gets or sets the url for the application logo image stored in a + /// CDN. + /// + [JsonProperty(PropertyName = "appLogoUrl")] + public string AppLogoUrl { get; set; } + + /// + /// Gets or sets the collection of application roles that an + /// application may declare. These roles can be assigned to users, + /// groups or service principals. + /// + [JsonProperty(PropertyName = "appRoles")] + public IList AppRoles { get; set; } + + /// + /// Gets or sets the application permissions. + /// + [JsonProperty(PropertyName = "appPermissions")] + public IList AppPermissions { get; set; } + + /// + /// Gets or sets whether the application is available to other tenants. + /// + [JsonProperty(PropertyName = "availableToOtherTenants")] + public bool? AvailableToOtherTenants { get; set; } + + /// + /// Gets or sets a URL provided by the author of the application to + /// report errors when using the application. + /// + [JsonProperty(PropertyName = "errorUrl")] + public string ErrorUrl { get; set; } + + /// + /// Gets or sets the home page of the application. + /// + [JsonProperty(PropertyName = "homepage")] + public string Homepage { get; set; } + + /// + /// Gets or sets urls with more informations of the application. + /// + [JsonProperty(PropertyName = "informationalUrls")] + public InformationalUrl InformationalUrls { get; set; } + + /// + /// Gets or sets specifies whether this application supports device + /// authentication without a user. The default is false. + /// + [JsonProperty(PropertyName = "isDeviceOnlyAuthSupported")] + public bool? IsDeviceOnlyAuthSupported { get; set; } + + /// + /// Gets or sets a collection of KeyCredential objects. + /// + [JsonProperty(PropertyName = "keyCredentials")] + public IList KeyCredentials { get; set; } + + /// + /// Gets or sets client applications that are tied to this resource + /// application. Consent to any of the known client applications will + /// result in implicit consent to the resource application through a + /// combined consent dialog (showing the OAuth permission scopes + /// required by the client and the resource). + /// + [JsonProperty(PropertyName = "knownClientApplications")] + public IList KnownClientApplications { get; set; } + + /// + /// Gets or sets the url of the logout page + /// + [JsonProperty(PropertyName = "logoutUrl")] + public string LogoutUrl { get; set; } + + /// + /// Gets or sets whether to allow implicit grant flow for OAuth2 + /// + [JsonProperty(PropertyName = "oauth2AllowImplicitFlow")] + public bool? Oauth2AllowImplicitFlow { get; set; } + + /// + /// Gets or sets specifies whether during a token Request Azure AD will + /// allow path matching of the redirect URI against the applications + /// collection of replyURLs. The default is false. + /// + [JsonProperty(PropertyName = "oauth2AllowUrlPathMatching")] + public bool? Oauth2AllowUrlPathMatching { get; set; } + + /// + /// Gets or sets the collection of OAuth 2.0 permission scopes that the + /// web API (resource) application exposes to client applications. + /// These permission scopes may be granted to client applications + /// during consent. + /// + [JsonProperty(PropertyName = "oauth2Permissions")] + public IList Oauth2Permissions { get; set; } + + /// + /// Gets or sets specifies whether, as part of OAuth 2.0 token + /// requests, Azure AD will allow POST requests, as opposed to GET + /// requests. The default is false, which specifies that only GET + /// requests will be allowed. + /// + [JsonProperty(PropertyName = "oauth2RequirePostResponse")] + public bool? Oauth2RequirePostResponse { get; set; } + + /// + /// Gets or sets a list of tenants allowed to access application. + /// + [JsonProperty(PropertyName = "orgRestrictions")] + public IList OrgRestrictions { get; set; } + + /// + /// + [JsonProperty(PropertyName = "optionalClaims")] + public OptionalClaims OptionalClaims { get; set; } + + /// + /// Gets or sets a collection of PasswordCredential objects + /// + [JsonProperty(PropertyName = "passwordCredentials")] + public IList PasswordCredentials { get; set; } + + /// + /// Gets or sets list of pre-authorizaed applications. + /// + [JsonProperty(PropertyName = "preAuthorizedApplications")] + public IList PreAuthorizedApplications { get; set; } + + /// + /// Gets or sets specifies whether this application is a public client + /// (such as an installed application running on a mobile device). + /// Default is false. + /// + [JsonProperty(PropertyName = "publicClient")] + public bool? PublicClient { get; set; } + + /// + /// Gets or sets reliable domain which can be used to identify an + /// application. + /// + [JsonProperty(PropertyName = "publisherDomain")] + public string PublisherDomain { get; set; } + + /// + /// Gets or sets a collection of reply URLs for the application. + /// + [JsonProperty(PropertyName = "replyUrls")] + public IList ReplyUrls { get; set; } + + /// + /// Gets or sets 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(PropertyName = "requiredResourceAccess")] + public IList RequiredResourceAccess { get; set; } + + /// + /// Gets or sets the URL to the SAML metadata for the application. + /// + [JsonProperty(PropertyName = "samlMetadataUrl")] + public string SamlMetadataUrl { get; set; } + + /// + /// Gets or sets audience for signing in to the application + /// (AzureADMyOrganizatio, AzureADAllorganizations, + /// AzureADAndMicrosofAccounts). + /// + [JsonProperty(PropertyName = "signInAudience")] + public string SignInAudience { get; set; } + + /// + /// Gets or sets the primary Web page. + /// + [JsonProperty(PropertyName = "wwwHomepage")] + public string WwwHomepage { get; set; } + + } +} diff --git a/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/Models/ApplicationCreateParameters.cs b/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/Models/ApplicationCreateParameters.cs index bbb9c2a97e44..97a2c4ffef8e 100644 --- a/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/Models/ApplicationCreateParameters.cs +++ b/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/Models/ApplicationCreateParameters.cs @@ -19,7 +19,7 @@ namespace Microsoft.Azure.Graph.RBAC.Models /// /// Request parameters for creating a new application. /// - public partial class ApplicationCreateParameters + public partial class ApplicationCreateParameters : ApplicationBase { /// /// Initializes a new instance of the ApplicationCreateParameters @@ -34,40 +34,83 @@ public ApplicationCreateParameters() /// Initializes a new instance of the ApplicationCreateParameters /// class. /// - /// Whether the application is - /// available to other tenants. /// The display name of the /// application. /// A collection of URIs for the /// application. - /// Unmatched properties from the - /// message are deserialized this collection + /// A property on the application to + /// indicate if the application accepts other IDPs or not or partially + /// accepts. + /// Indicates that the application + /// supports pass through users who have no presence in the resource + /// tenant. + /// The url for the application logo image + /// stored in a CDN. + /// The collection of application roles that an + /// application may declare. These roles can be assigned to users, + /// groups or service principals. + /// The application permissions. + /// Whether the application is + /// available to other tenants. + /// A URL provided by the author of the + /// application to report errors when using the application. /// The home page of the application. - /// A collection of reply URLs for the + /// urls with more informations of the /// application. - /// The list of KeyCredential - /// objects. - /// The list of PasswordCredential + /// Specifies whether this + /// application supports device authentication without a user. The + /// default is false. + /// A collection of KeyCredential /// objects. + /// Client applications that are + /// tied to this resource application. Consent to any of the known + /// client applications will result in implicit consent to the resource + /// application through a combined consent dialog (showing the OAuth + /// permission scopes required by the client and the resource). + /// the url of the logout page /// Whether to allow implicit /// grant flow for OAuth2 + /// Specifies whether during a + /// token Request Azure AD will allow path matching of the redirect URI + /// against the applications collection of replyURLs. The default is + /// false. + /// The collection of OAuth 2.0 + /// permission scopes that the web API (resource) application exposes + /// to client applications. These permission scopes may be granted to + /// client applications during consent. + /// Specifies whether, as part + /// of OAuth 2.0 token requests, Azure AD will allow POST requests, as + /// opposed to GET requests. The default is false, which specifies that + /// only GET requests will be allowed. + /// A list of tenants allowed to access + /// application. + /// A collection of + /// PasswordCredential objects + /// list of pre-authorizaed + /// applications. + /// Specifies whether this application is a + /// public client (such as an installed application running on a mobile + /// device). Default is false. + /// Reliable domain which can be used to + /// identify an application. + /// A collection of reply URLs for the + /// application. /// 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. - public ApplicationCreateParameters(bool availableToOtherTenants, string displayName, IList identifierUris, IDictionary additionalProperties = default(IDictionary), string homepage = default(string), IList replyUrls = default(IList), IList keyCredentials = default(IList), IList passwordCredentials = default(IList), bool? oauth2AllowImplicitFlow = default(bool?), IList requiredResourceAccess = default(IList)) + /// The URL to the SAML metadata for the + /// application. + /// Audience for signing in to the + /// application (AzureADMyOrganizatio, AzureADAllorganizations, + /// AzureADAndMicrosofAccounts). + /// The primary Web page. + public ApplicationCreateParameters(string displayName, IList identifierUris, bool? allowGuestsSignIn = default(bool?), bool? allowPassthroughUsers = default(bool?), string appLogoUrl = default(string), IList appRoles = default(IList), IList appPermissions = default(IList), bool? availableToOtherTenants = default(bool?), string errorUrl = default(string), string homepage = default(string), InformationalUrl informationalUrls = default(InformationalUrl), bool? isDeviceOnlyAuthSupported = default(bool?), IList keyCredentials = default(IList), IList knownClientApplications = default(IList), string logoutUrl = default(string), bool? oauth2AllowImplicitFlow = default(bool?), bool? oauth2AllowUrlPathMatching = default(bool?), IList oauth2Permissions = default(IList), bool? oauth2RequirePostResponse = default(bool?), IList orgRestrictions = default(IList), OptionalClaims optionalClaims = default(OptionalClaims), IList passwordCredentials = default(IList), IList preAuthorizedApplications = default(IList), bool? publicClient = default(bool?), string publisherDomain = default(string), IList replyUrls = default(IList), IList requiredResourceAccess = default(IList), string samlMetadataUrl = default(string), string signInAudience = default(string), string wwwHomepage = default(string)) + : base(allowGuestsSignIn, allowPassthroughUsers, appLogoUrl, appRoles, appPermissions, availableToOtherTenants, errorUrl, homepage, informationalUrls, isDeviceOnlyAuthSupported, keyCredentials, knownClientApplications, logoutUrl, oauth2AllowImplicitFlow, oauth2AllowUrlPathMatching, oauth2Permissions, oauth2RequirePostResponse, orgRestrictions, optionalClaims, passwordCredentials, preAuthorizedApplications, publicClient, publisherDomain, replyUrls, requiredResourceAccess, samlMetadataUrl, signInAudience, wwwHomepage) { - AdditionalProperties = additionalProperties; - AvailableToOtherTenants = availableToOtherTenants; DisplayName = displayName; - Homepage = homepage; IdentifierUris = identifierUris; - ReplyUrls = replyUrls; - KeyCredentials = keyCredentials; - PasswordCredentials = passwordCredentials; - Oauth2AllowImplicitFlow = oauth2AllowImplicitFlow; - RequiredResourceAccess = requiredResourceAccess; CustomInit(); } @@ -76,71 +119,18 @@ public ApplicationCreateParameters() /// partial void CustomInit(); - /// - /// Gets or sets unmatched properties from the message are deserialized - /// this collection - /// - [JsonExtensionData] - public IDictionary AdditionalProperties { get; set; } - - /// - /// Gets or sets whether the application is available to other tenants. - /// - [JsonProperty(PropertyName = "availableToOtherTenants")] - public bool AvailableToOtherTenants { get; set; } - /// /// Gets or sets the display name of the application. /// [JsonProperty(PropertyName = "displayName")] public string DisplayName { get; set; } - /// - /// Gets or sets the home page of the application. - /// - [JsonProperty(PropertyName = "homepage")] - public string Homepage { get; set; } - /// /// Gets or sets a collection of URIs for the application. /// [JsonProperty(PropertyName = "identifierUris")] public IList IdentifierUris { get; set; } - /// - /// Gets or sets a collection of reply URLs for the application. - /// - [JsonProperty(PropertyName = "replyUrls")] - public IList ReplyUrls { get; set; } - - /// - /// Gets or sets the list of KeyCredential objects. - /// - [JsonProperty(PropertyName = "keyCredentials")] - public IList KeyCredentials { get; set; } - - /// - /// Gets or sets the list of PasswordCredential objects. - /// - [JsonProperty(PropertyName = "passwordCredentials")] - public IList PasswordCredentials { get; set; } - - /// - /// Gets or sets whether to allow implicit grant flow for OAuth2 - /// - [JsonProperty(PropertyName = "oauth2AllowImplicitFlow")] - public bool? Oauth2AllowImplicitFlow { get; set; } - - /// - /// Gets or sets 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(PropertyName = "requiredResourceAccess")] - public IList RequiredResourceAccess { get; set; } - /// /// Validate the object. /// @@ -157,16 +147,6 @@ public virtual void Validate() { throw new ValidationException(ValidationRules.CannotBeNull, "IdentifierUris"); } - if (RequiredResourceAccess != null) - { - foreach (var element in RequiredResourceAccess) - { - if (element != null) - { - element.Validate(); - } - } - } } } } diff --git a/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/Models/ApplicationUpdateParameters.cs b/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/Models/ApplicationUpdateParameters.cs index 6dd9ddfd1638..9597d8532beb 100644 --- a/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/Models/ApplicationUpdateParameters.cs +++ b/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/Models/ApplicationUpdateParameters.cs @@ -16,9 +16,9 @@ namespace Microsoft.Azure.Graph.RBAC.Models using System.Linq; /// - /// Request parameters for updating an existing application. + /// Request parameters for updating a new application. /// - public partial class ApplicationUpdateParameters + public partial class ApplicationUpdateParameters : ApplicationBase { /// /// Initializes a new instance of the ApplicationUpdateParameters @@ -33,40 +33,83 @@ public ApplicationUpdateParameters() /// Initializes a new instance of the ApplicationUpdateParameters /// class. /// - /// Unmatched properties from the - /// message are deserialized this collection + /// A property on the application to + /// indicate if the application accepts other IDPs or not or partially + /// accepts. + /// Indicates that the application + /// supports pass through users who have no presence in the resource + /// tenant. + /// The url for the application logo image + /// stored in a CDN. + /// The collection of application roles that an + /// application may declare. These roles can be assigned to users, + /// groups or service principals. + /// The application permissions. /// Whether the application is - /// available to other tenants - /// The display name of the - /// application. + /// available to other tenants. + /// A URL provided by the author of the + /// application to report errors when using the application. /// The home page of the application. - /// A collection of URIs for the - /// application. - /// A collection of reply URLs for the + /// urls with more informations of the /// application. - /// The list of KeyCredential - /// objects. - /// The list of PasswordCredential + /// Specifies whether this + /// application supports device authentication without a user. The + /// default is false. + /// A collection of KeyCredential /// objects. + /// Client applications that are + /// tied to this resource application. Consent to any of the known + /// client applications will result in implicit consent to the resource + /// application through a combined consent dialog (showing the OAuth + /// permission scopes required by the client and the resource). + /// the url of the logout page /// Whether to allow implicit /// grant flow for OAuth2 + /// Specifies whether during a + /// token Request Azure AD will allow path matching of the redirect URI + /// against the applications collection of replyURLs. The default is + /// false. + /// The collection of OAuth 2.0 + /// permission scopes that the web API (resource) application exposes + /// to client applications. These permission scopes may be granted to + /// client applications during consent. + /// Specifies whether, as part + /// of OAuth 2.0 token requests, Azure AD will allow POST requests, as + /// opposed to GET requests. The default is false, which specifies that + /// only GET requests will be allowed. + /// A list of tenants allowed to access + /// application. + /// A collection of + /// PasswordCredential objects + /// list of pre-authorizaed + /// applications. + /// Specifies whether this application is a + /// public client (such as an installed application running on a mobile + /// device). Default is false. + /// Reliable domain which can be used to + /// identify an application. + /// A collection of reply URLs for the + /// application. /// 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. - public ApplicationUpdateParameters(IDictionary additionalProperties = default(IDictionary), bool? availableToOtherTenants = default(bool?), string displayName = default(string), string homepage = default(string), IList identifierUris = default(IList), IList replyUrls = default(IList), IList keyCredentials = default(IList), IList passwordCredentials = default(IList), bool? oauth2AllowImplicitFlow = default(bool?), IList requiredResourceAccess = default(IList)) + /// The URL to the SAML metadata for the + /// application. + /// Audience for signing in to the + /// application (AzureADMyOrganizatio, AzureADAllorganizations, + /// AzureADAndMicrosofAccounts). + /// The primary Web page. + /// The display name of the + /// application. + /// A collection of URIs for the + /// application. + public ApplicationUpdateParameters(bool? allowGuestsSignIn = default(bool?), bool? allowPassthroughUsers = default(bool?), string appLogoUrl = default(string), IList appRoles = default(IList), IList appPermissions = default(IList), bool? availableToOtherTenants = default(bool?), string errorUrl = default(string), string homepage = default(string), InformationalUrl informationalUrls = default(InformationalUrl), bool? isDeviceOnlyAuthSupported = default(bool?), IList keyCredentials = default(IList), IList knownClientApplications = default(IList), string logoutUrl = default(string), bool? oauth2AllowImplicitFlow = default(bool?), bool? oauth2AllowUrlPathMatching = default(bool?), IList oauth2Permissions = default(IList), bool? oauth2RequirePostResponse = default(bool?), IList orgRestrictions = default(IList), OptionalClaims optionalClaims = default(OptionalClaims), IList passwordCredentials = default(IList), IList preAuthorizedApplications = default(IList), bool? publicClient = default(bool?), string publisherDomain = default(string), IList replyUrls = default(IList), IList requiredResourceAccess = default(IList), string samlMetadataUrl = default(string), string signInAudience = default(string), string wwwHomepage = default(string), string displayName = default(string), IList identifierUris = default(IList)) + : base(allowGuestsSignIn, allowPassthroughUsers, appLogoUrl, appRoles, appPermissions, availableToOtherTenants, errorUrl, homepage, informationalUrls, isDeviceOnlyAuthSupported, keyCredentials, knownClientApplications, logoutUrl, oauth2AllowImplicitFlow, oauth2AllowUrlPathMatching, oauth2Permissions, oauth2RequirePostResponse, orgRestrictions, optionalClaims, passwordCredentials, preAuthorizedApplications, publicClient, publisherDomain, replyUrls, requiredResourceAccess, samlMetadataUrl, signInAudience, wwwHomepage) { - AdditionalProperties = additionalProperties; - AvailableToOtherTenants = availableToOtherTenants; DisplayName = displayName; - Homepage = homepage; IdentifierUris = identifierUris; - ReplyUrls = replyUrls; - KeyCredentials = keyCredentials; - PasswordCredentials = passwordCredentials; - Oauth2AllowImplicitFlow = oauth2AllowImplicitFlow; - RequiredResourceAccess = requiredResourceAccess; CustomInit(); } @@ -75,70 +118,17 @@ public ApplicationUpdateParameters() /// partial void CustomInit(); - /// - /// Gets or sets unmatched properties from the message are deserialized - /// this collection - /// - [JsonExtensionData] - public IDictionary AdditionalProperties { get; set; } - - /// - /// Gets or sets whether the application is available to other tenants - /// - [JsonProperty(PropertyName = "availableToOtherTenants")] - public bool? AvailableToOtherTenants { get; set; } - /// /// Gets or sets the display name of the application. /// [JsonProperty(PropertyName = "displayName")] public string DisplayName { get; set; } - /// - /// Gets or sets the home page of the application. - /// - [JsonProperty(PropertyName = "homepage")] - public string Homepage { get; set; } - /// /// Gets or sets a collection of URIs for the application. /// [JsonProperty(PropertyName = "identifierUris")] public IList IdentifierUris { get; set; } - /// - /// Gets or sets a collection of reply URLs for the application. - /// - [JsonProperty(PropertyName = "replyUrls")] - public IList ReplyUrls { get; set; } - - /// - /// Gets or sets the list of KeyCredential objects. - /// - [JsonProperty(PropertyName = "keyCredentials")] - public IList KeyCredentials { get; set; } - - /// - /// Gets or sets the list of PasswordCredential objects. - /// - [JsonProperty(PropertyName = "passwordCredentials")] - public IList PasswordCredentials { get; set; } - - /// - /// Gets or sets whether to allow implicit grant flow for OAuth2 - /// - [JsonProperty(PropertyName = "oauth2AllowImplicitFlow")] - public bool? Oauth2AllowImplicitFlow { get; set; } - - /// - /// Gets or sets 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(PropertyName = "requiredResourceAccess")] - public IList RequiredResourceAccess { get; set; } - } } diff --git a/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/Models/GetObjectsParameters.cs b/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/Models/GetObjectsParameters.cs index 5ae0f7ff40f9..4e36a0b6ff52 100644 --- a/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/Models/GetObjectsParameters.cs +++ b/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/Models/GetObjectsParameters.cs @@ -31,13 +31,13 @@ public GetObjectsParameters() /// /// Initializes a new instance of the GetObjectsParameters class. /// - /// If true, also - /// searches for object IDs in the partner tenant. /// Unmatched properties from the /// message are deserialized this collection /// The requested object IDs. /// The requested object types. - public GetObjectsParameters(bool includeDirectoryObjectReferences, IDictionary additionalProperties = default(IDictionary), IList objectIds = default(IList), IList types = default(IList)) + /// If true, also + /// searches for object IDs in the partner tenant. + public GetObjectsParameters(IDictionary additionalProperties = default(IDictionary), IList objectIds = default(IList), IList types = default(IList), bool? includeDirectoryObjectReferences = default(bool?)) { AdditionalProperties = additionalProperties; ObjectIds = objectIds; @@ -75,16 +75,7 @@ public GetObjectsParameters() /// tenant. /// [JsonProperty(PropertyName = "includeDirectoryObjectReferences")] - public bool IncludeDirectoryObjectReferences { get; set; } + public bool? IncludeDirectoryObjectReferences { get; set; } - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - } } } diff --git a/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/Models/InformationalUrl.cs b/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/Models/InformationalUrl.cs new file mode 100644 index 000000000000..b887a6810c33 --- /dev/null +++ b/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/Models/InformationalUrl.cs @@ -0,0 +1,77 @@ +// +// 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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Graph.RBAC.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Represents a group of URIs that provide terms of service, marketing, + /// support and privacy policy information about an application. The + /// default value for each string is null. + /// + public partial class InformationalUrl + { + /// + /// Initializes a new instance of the InformationalUrl class. + /// + public InformationalUrl() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the InformationalUrl class. + /// + /// The terms of service URI + /// The marketing URI + /// The privacy policy URI + /// The support URI + public InformationalUrl(string termsOfService = default(string), string marketing = default(string), string privacy = default(string), string support = default(string)) + { + TermsOfService = termsOfService; + Marketing = marketing; + Privacy = privacy; + Support = support; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the terms of service URI + /// + [JsonProperty(PropertyName = "termsOfService")] + public string TermsOfService { get; set; } + + /// + /// Gets or sets the marketing URI + /// + [JsonProperty(PropertyName = "marketing")] + public string Marketing { get; set; } + + /// + /// Gets or sets the privacy policy URI + /// + [JsonProperty(PropertyName = "privacy")] + public string Privacy { get; set; } + + /// + /// Gets or sets the support URI + /// + [JsonProperty(PropertyName = "support")] + public string Support { get; set; } + + } +} diff --git a/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/Models/KeyCredential.cs b/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/Models/KeyCredential.cs index f20763ff7255..3f411bd5760f 100644 --- a/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/Models/KeyCredential.cs +++ b/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/Models/KeyCredential.cs @@ -42,7 +42,7 @@ public KeyCredential() /// Type. Acceptable values are 'AsymmetricX509Cert' /// and 'Symmetric'. /// Custom Key Identifier - public KeyCredential(IDictionary additionalProperties = default(IDictionary), System.DateTime? startDate = default(System.DateTime?), System.DateTime? endDate = default(System.DateTime?), string value = default(string), string keyId = default(string), string usage = default(string), string type = default(string), byte[] customKeyIdentifier = default(byte[])) + public KeyCredential(IDictionary additionalProperties = default(IDictionary), System.DateTime? startDate = default(System.DateTime?), System.DateTime? endDate = default(System.DateTime?), string value = default(string), string keyId = default(string), string usage = default(string), string type = default(string), string customKeyIdentifier = default(string)) { AdditionalProperties = additionalProperties; StartDate = startDate; @@ -108,7 +108,7 @@ public KeyCredential() /// Gets or sets custom Key Identifier /// [JsonProperty(PropertyName = "customKeyIdentifier")] - public byte[] CustomKeyIdentifier { get; set; } + public string CustomKeyIdentifier { get; set; } } } diff --git a/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/Models/OAuth2Permission.cs b/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/Models/OAuth2Permission.cs new file mode 100644 index 000000000000..19f90e7fff89 --- /dev/null +++ b/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/Models/OAuth2Permission.cs @@ -0,0 +1,139 @@ +// +// 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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Graph.RBAC.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Represents an OAuth 2.0 delegated permission scope. The specified OAuth + /// 2.0 delegated permission scopes may be requested by client applications + /// (through the requiredResourceAccess collection on the Application + /// object) when calling a resource application. The oauth2Permissions + /// property of the ServicePrincipal entity and of the Application entity + /// is a collection of OAuth2Permission. + /// + public partial class OAuth2Permission + { + /// + /// Initializes a new instance of the OAuth2Permission class. + /// + public OAuth2Permission() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the OAuth2Permission class. + /// + /// Permission help text that + /// appears in the admin consent and app assignment + /// experiences. + /// Display name for the + /// permission that appears in the admin consent and app assignment + /// experiences. + /// Unique scope permission identifier inside the + /// oauth2Permissions collection. + /// When creating or updating a permission, + /// this property must be set to true (which is the default). To delete + /// a permission, this property must first be set to false. At that + /// point, in a subsequent call, the permission may be removed. + /// + /// Specifies whether this scope permission can be + /// consented to by an end user, or whether it is a tenant-wide + /// permission that must be consented to by a Company Administrator. + /// Possible values are "User" or "Admin". + /// Permission help text that + /// appears in the end user consent experience. + /// Display name for the + /// permission that appears in the end user consent experience. + /// The value of the scope claim that the resource + /// application should expect in the OAuth 2.0 access token. + public OAuth2Permission(string adminConsentDescription = default(string), string adminConsentDisplayName = default(string), string id = default(string), bool? isEnabled = default(bool?), string type = default(string), string userConsentDescription = default(string), string userConsentDisplayName = default(string), string value = default(string)) + { + AdminConsentDescription = adminConsentDescription; + AdminConsentDisplayName = adminConsentDisplayName; + Id = id; + IsEnabled = isEnabled; + Type = type; + UserConsentDescription = userConsentDescription; + UserConsentDisplayName = userConsentDisplayName; + Value = value; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets permission help text that appears in the admin consent + /// and app assignment experiences. + /// + [JsonProperty(PropertyName = "adminConsentDescription")] + public string AdminConsentDescription { get; set; } + + /// + /// Gets or sets display name for the permission that appears in the + /// admin consent and app assignment experiences. + /// + [JsonProperty(PropertyName = "adminConsentDisplayName")] + public string AdminConsentDisplayName { get; set; } + + /// + /// Gets or sets unique scope permission identifier inside the + /// oauth2Permissions collection. + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; set; } + + /// + /// Gets or sets when creating or updating a permission, this property + /// must be set to true (which is the default). To delete a permission, + /// this property must first be set to false. At that point, in a + /// subsequent call, the permission may be removed. + /// + [JsonProperty(PropertyName = "isEnabled")] + public bool? IsEnabled { get; set; } + + /// + /// Gets or sets specifies whether this scope permission can be + /// consented to by an end user, or whether it is a tenant-wide + /// permission that must be consented to by a Company Administrator. + /// Possible values are "User" or "Admin". + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; set; } + + /// + /// Gets or sets permission help text that appears in the end user + /// consent experience. + /// + [JsonProperty(PropertyName = "userConsentDescription")] + public string UserConsentDescription { get; set; } + + /// + /// Gets or sets display name for the permission that appears in the + /// end user consent experience. + /// + [JsonProperty(PropertyName = "userConsentDisplayName")] + public string UserConsentDisplayName { get; set; } + + /// + /// Gets or sets the value of the scope claim that the resource + /// application should expect in the OAuth 2.0 access token. + /// + [JsonProperty(PropertyName = "value")] + public string Value { get; set; } + + } +} diff --git a/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/Models/OptionalClaim.cs b/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/Models/OptionalClaim.cs new file mode 100644 index 000000000000..7736e485c4e0 --- /dev/null +++ b/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/Models/OptionalClaim.cs @@ -0,0 +1,73 @@ +// +// 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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Graph.RBAC.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Specifying the claims to be included in a token. + /// + public partial class OptionalClaim + { + /// + /// Initializes a new instance of the OptionalClaim class. + /// + public OptionalClaim() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the OptionalClaim class. + /// + /// Claim name. + /// Claim source. + /// Is this a requied claim. + public OptionalClaim(string name = default(string), string source = default(string), bool? essential = default(bool?), object additionalProperties = default(object)) + { + Name = name; + Source = source; + Essential = essential; + AdditionalProperties = additionalProperties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets claim name. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets claim source. + /// + [JsonProperty(PropertyName = "source")] + public string Source { get; set; } + + /// + /// Gets or sets is this a requied claim. + /// + [JsonProperty(PropertyName = "essential")] + public bool? Essential { get; set; } + + /// + /// + [JsonProperty(PropertyName = "additionalProperties")] + public object AdditionalProperties { get; set; } + + } +} diff --git a/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/Models/OptionalClaims.cs b/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/Models/OptionalClaims.cs new file mode 100644 index 000000000000..1b616661cbee --- /dev/null +++ b/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/Models/OptionalClaims.cs @@ -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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Graph.RBAC.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Specifying the claims to be included in the token. + /// + public partial class OptionalClaims + { + /// + /// Initializes a new instance of the OptionalClaims class. + /// + public OptionalClaims() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the OptionalClaims class. + /// + /// Optional claims requested to be included in + /// the id token. + /// Optional claims requested to be included + /// in the access token. + /// Optional claims requested to be included in + /// the saml token. + public OptionalClaims(IList idToken = default(IList), IList accessToken = default(IList), IList samlToken = default(IList)) + { + IdToken = idToken; + AccessToken = accessToken; + SamlToken = samlToken; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets optional claims requested to be included in the id + /// token. + /// + [JsonProperty(PropertyName = "idToken")] + public IList IdToken { get; set; } + + /// + /// Gets or sets optional claims requested to be included in the access + /// token. + /// + [JsonProperty(PropertyName = "accessToken")] + public IList AccessToken { get; set; } + + /// + /// Gets or sets optional claims requested to be included in the saml + /// token. + /// + [JsonProperty(PropertyName = "samlToken")] + public IList SamlToken { get; set; } + + } +} diff --git a/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/Models/PasswordCredential.cs b/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/Models/PasswordCredential.cs index cd8708641a34..b07c8c65a4ed 100644 --- a/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/Models/PasswordCredential.cs +++ b/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/Models/PasswordCredential.cs @@ -37,13 +37,15 @@ public PasswordCredential() /// End date. /// Key ID. /// Key value. - public PasswordCredential(IDictionary additionalProperties = default(IDictionary), System.DateTime? startDate = default(System.DateTime?), System.DateTime? endDate = default(System.DateTime?), string keyId = default(string), string value = default(string)) + /// Custom Key Identifier + public PasswordCredential(IDictionary additionalProperties = default(IDictionary), System.DateTime? startDate = default(System.DateTime?), System.DateTime? endDate = default(System.DateTime?), string keyId = default(string), string value = default(string), byte[] customKeyIdentifier = default(byte[])) { AdditionalProperties = additionalProperties; StartDate = startDate; EndDate = endDate; KeyId = keyId; Value = value; + CustomKeyIdentifier = customKeyIdentifier; CustomInit(); } @@ -83,5 +85,11 @@ public PasswordCredential() [JsonProperty(PropertyName = "value")] public string Value { get; set; } + /// + /// Gets or sets custom Key Identifier + /// + [JsonProperty(PropertyName = "customKeyIdentifier")] + public byte[] CustomKeyIdentifier { get; set; } + } } diff --git a/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/Models/Permissions.cs b/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/Models/Permissions.cs index 0345d924ef5e..a4eac19eb207 100644 --- a/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/Models/Permissions.cs +++ b/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/Models/Permissions.cs @@ -30,6 +30,7 @@ public Permissions() /// name="odatatype">Microsoft.DirectoryServices.OAuth2PermissionGrant /// The objectId of the Service Principal /// associated with the app + /// The objectId of the permission grant /// Typically set to AllPrincipals /// Set to null if AllPrincipals is /// set @@ -38,10 +39,11 @@ public Permissions() /// Typically set to user_impersonation /// Start time for TTL /// Expiry time for TTL - public Permissions(string odatatype = default(string), string clientId = default(string), string consentType = default(string), object principalId = default(object), string resourceId = default(string), string scope = default(string), string startTime = default(string), string expiryTime = default(string)) + public Permissions(string odatatype = default(string), string clientId = default(string), string objectId = default(string), string consentType = default(string), object principalId = default(object), string resourceId = default(string), string scope = default(string), string startTime = default(string), string expiryTime = default(string)) { Odatatype = odatatype; ClientId = clientId; + ObjectId = objectId; ConsentType = consentType; PrincipalId = principalId; ResourceId = resourceId; @@ -69,6 +71,12 @@ public Permissions() [JsonProperty(PropertyName = "clientId")] public string ClientId { get; set; } + /// + /// Gets or sets the objectId of the permission grant + /// + [JsonProperty(PropertyName = "objectId")] + public string ObjectId { get; set; } + /// /// Gets or sets typically set to AllPrincipals /// diff --git a/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/Models/PreAuthorizedApplication.cs b/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/Models/PreAuthorizedApplication.cs new file mode 100644 index 000000000000..0cce315e1b14 --- /dev/null +++ b/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/Models/PreAuthorizedApplication.cs @@ -0,0 +1,73 @@ +// +// 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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Graph.RBAC.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Contains information about pre authorized client application. + /// + public partial class PreAuthorizedApplication + { + /// + /// Initializes a new instance of the PreAuthorizedApplication class. + /// + public PreAuthorizedApplication() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PreAuthorizedApplication class. + /// + /// Represents the application id. + /// Collection of required app + /// permissions/entitlements from the resource application. + /// Collection of extensions from the resource + /// application. + public PreAuthorizedApplication(string appId = default(string), IList permissions = default(IList), IList extensions = default(IList)) + { + AppId = appId; + Permissions = permissions; + Extensions = extensions; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets represents the application id. + /// + [JsonProperty(PropertyName = "appId")] + public string AppId { get; set; } + + /// + /// Gets or sets collection of required app permissions/entitlements + /// from the resource application. + /// + [JsonProperty(PropertyName = "permissions")] + public IList Permissions { get; set; } + + /// + /// Gets or sets collection of extensions from the resource + /// application. + /// + [JsonProperty(PropertyName = "extensions")] + public IList Extensions { get; set; } + + } +} diff --git a/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/Models/PreAuthorizedApplicationExtension.cs b/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/Models/PreAuthorizedApplicationExtension.cs new file mode 100644 index 000000000000..22b5d85c4daa --- /dev/null +++ b/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/Models/PreAuthorizedApplicationExtension.cs @@ -0,0 +1,56 @@ +// +// 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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Graph.RBAC.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Representation of an app PreAuthorizedApplicationExtension required by + /// a pre authorized client app. + /// + public partial class PreAuthorizedApplicationExtension + { + /// + /// Initializes a new instance of the PreAuthorizedApplicationExtension + /// class. + /// + public PreAuthorizedApplicationExtension() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PreAuthorizedApplicationExtension + /// class. + /// + /// The extension's conditions. + public PreAuthorizedApplicationExtension(IList conditions = default(IList)) + { + Conditions = conditions; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the extension's conditions. + /// + [JsonProperty(PropertyName = "conditions")] + public IList Conditions { get; set; } + + } +} diff --git a/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/Models/PreAuthorizedApplicationPermission.cs b/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/Models/PreAuthorizedApplicationPermission.cs new file mode 100644 index 000000000000..3af8fdc0298f --- /dev/null +++ b/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/Models/PreAuthorizedApplicationPermission.cs @@ -0,0 +1,65 @@ +// +// 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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Graph.RBAC.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Contains information about the pre-authorized permissions. + /// + public partial class PreAuthorizedApplicationPermission + { + /// + /// Initializes a new instance of the + /// PreAuthorizedApplicationPermission class. + /// + public PreAuthorizedApplicationPermission() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// PreAuthorizedApplicationPermission class. + /// + /// Indicates whether the permission + /// set is DirectAccess or impersonation. + /// The list of permissions. + public PreAuthorizedApplicationPermission(bool? directAccessGrant = default(bool?), IList accessGrants = default(IList)) + { + DirectAccessGrant = directAccessGrant; + AccessGrants = accessGrants; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets indicates whether the permission set is DirectAccess + /// or impersonation. + /// + [JsonProperty(PropertyName = "directAccessGrant")] + public bool? DirectAccessGrant { get; set; } + + /// + /// Gets or sets the list of permissions. + /// + [JsonProperty(PropertyName = "accessGrants")] + public IList AccessGrants { get; set; } + + } +} diff --git a/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/Models/RequiredResourceAccess.cs b/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/Models/RequiredResourceAccess.cs index 423509b49d34..2c236599b22a 100644 --- a/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/Models/RequiredResourceAccess.cs +++ b/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/Models/RequiredResourceAccess.cs @@ -22,7 +22,7 @@ namespace Microsoft.Azure.Graph.RBAC.Models /// 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. + /// the Application entity is a collection of RequiredResourceAccess. /// public partial class RequiredResourceAccess { diff --git a/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/Models/ServicePrincipal.cs b/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/Models/ServicePrincipal.cs index 462b469614a3..f66e7dbea7bc 100644 --- a/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/Models/ServicePrincipal.cs +++ b/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/Models/ServicePrincipal.cs @@ -36,17 +36,73 @@ public ServicePrincipal() /// The object ID. /// The time at which the directory /// object was deleted. + /// whether or not the service principal + /// account is enabled + /// altenative names + /// The display name exposed by the + /// associated application. + /// The application ID. + /// Specifies whether an + /// AppRoleAssignment to a user or group is required before Azure AD + /// will issue a user or access token to the application. + /// The collection of application roles that an + /// application may declare. These roles can be assigned to users, + /// groups or service principals. /// The display name of the service /// principal. - /// The application ID. + /// A URL provided by the author of the + /// associated application to report errors when using the + /// application. + /// The URL to the homepage of the associated + /// application. + /// The collection of key credentials + /// associated with the service principal. + /// A URL provided by the author of the + /// associated application to logout + /// The OAuth 2.0 permissions exposed + /// by the associated application. + /// The collection of password + /// credentials associated with the service principal. + /// The thubmbprint of + /// preferred certificate to sign the token + /// The publisher's name of the associated + /// application + /// The URLs that user tokens are sent to for + /// sign in with the associated application. The redirect URIs that + /// the oAuth 2.0 authorization code and access tokens are sent to for + /// the associated application. + /// The URL to the SAML metadata of the + /// associated application /// A collection of service /// principal names. - public ServicePrincipal(IDictionary additionalProperties = default(IDictionary), string objectId = default(string), System.DateTime? deletionTimestamp = default(System.DateTime?), string displayName = default(string), string appId = default(string), IList servicePrincipalNames = default(IList)) + /// the type of the servie + /// principal + /// Optional list of tags that you can apply to your + /// service principals. Not nullable. + public ServicePrincipal(IDictionary additionalProperties = default(IDictionary), string objectId = default(string), System.DateTime? deletionTimestamp = default(System.DateTime?), string accountEnabled = default(string), IList alternativeNames = default(IList), string appDisplayName = default(string), string appId = default(string), string appOwnerTenantId = default(string), bool? appRoleAssignmentRequired = default(bool?), IList appRoles = default(IList), string displayName = default(string), string errorUrl = default(string), string homepage = default(string), IList keyCredentials = default(IList), string logoutUrl = default(string), IList oauth2Permissions = default(IList), IList passwordCredentials = default(IList), string preferredTokenSigningKeyThumbprint = default(string), string publisherName = default(string), IList replyUrls = default(IList), string samlMetadataUrl = default(string), IList servicePrincipalNames = default(IList), string servicePrincipalType = default(string), IList tags = default(IList)) : base(additionalProperties, objectId, deletionTimestamp) { - DisplayName = displayName; + AccountEnabled = accountEnabled; + AlternativeNames = alternativeNames; + AppDisplayName = appDisplayName; AppId = appId; + AppOwnerTenantId = appOwnerTenantId; + AppRoleAssignmentRequired = appRoleAssignmentRequired; + AppRoles = appRoles; + DisplayName = displayName; + ErrorUrl = errorUrl; + Homepage = homepage; + KeyCredentials = keyCredentials; + LogoutUrl = logoutUrl; + Oauth2Permissions = oauth2Permissions; + PasswordCredentials = passwordCredentials; + PreferredTokenSigningKeyThumbprint = preferredTokenSigningKeyThumbprint; + PublisherName = publisherName; + ReplyUrls = replyUrls; + SamlMetadataUrl = samlMetadataUrl; ServicePrincipalNames = servicePrincipalNames; + ServicePrincipalType = servicePrincipalType; + Tags = tags; CustomInit(); } @@ -56,10 +112,23 @@ public ServicePrincipal() partial void CustomInit(); /// - /// Gets or sets the display name of the service principal. + /// Gets or sets whether or not the service principal account is + /// enabled /// - [JsonProperty(PropertyName = "displayName")] - public string DisplayName { get; set; } + [JsonProperty(PropertyName = "accountEnabled")] + public string AccountEnabled { get; set; } + + /// + /// Gets or sets altenative names + /// + [JsonProperty(PropertyName = "alternativeNames")] + public IList AlternativeNames { get; set; } + + /// + /// Gets the display name exposed by the associated application. + /// + [JsonProperty(PropertyName = "appDisplayName")] + public string AppDisplayName { get; private set; } /// /// Gets or sets the application ID. @@ -67,11 +136,121 @@ public ServicePrincipal() [JsonProperty(PropertyName = "appId")] public string AppId { get; set; } + /// + /// + [JsonProperty(PropertyName = "appOwnerTenantId")] + public string AppOwnerTenantId { get; private set; } + + /// + /// Gets or sets specifies whether an AppRoleAssignment to a user or + /// group is required before Azure AD will issue a user or access token + /// to the application. + /// + [JsonProperty(PropertyName = "appRoleAssignmentRequired")] + public bool? AppRoleAssignmentRequired { get; set; } + + /// + /// Gets or sets the collection of application roles that an + /// application may declare. These roles can be assigned to users, + /// groups or service principals. + /// + [JsonProperty(PropertyName = "appRoles")] + public IList AppRoles { get; set; } + + /// + /// Gets or sets the display name of the service principal. + /// + [JsonProperty(PropertyName = "displayName")] + public string DisplayName { get; set; } + + /// + /// Gets or sets a URL provided by the author of the associated + /// application to report errors when using the application. + /// + [JsonProperty(PropertyName = "errorUrl")] + public string ErrorUrl { get; set; } + + /// + /// Gets or sets the URL to the homepage of the associated application. + /// + [JsonProperty(PropertyName = "homepage")] + public string Homepage { get; set; } + + /// + /// Gets or sets the collection of key credentials associated with the + /// service principal. + /// + [JsonProperty(PropertyName = "keyCredentials")] + public IList KeyCredentials { get; set; } + + /// + /// Gets or sets a URL provided by the author of the associated + /// application to logout + /// + [JsonProperty(PropertyName = "logoutUrl")] + public string LogoutUrl { get; set; } + + /// + /// Gets the OAuth 2.0 permissions exposed by the associated + /// application. + /// + [JsonProperty(PropertyName = "oauth2Permissions")] + public IList Oauth2Permissions { get; private set; } + + /// + /// Gets or sets the collection of password credentials associated with + /// the service principal. + /// + [JsonProperty(PropertyName = "passwordCredentials")] + public IList PasswordCredentials { get; set; } + + /// + /// Gets or sets the thubmbprint of preferred certificate to sign the + /// token + /// + [JsonProperty(PropertyName = "preferredTokenSigningKeyThumbprint")] + public string PreferredTokenSigningKeyThumbprint { get; set; } + + /// + /// Gets or sets the publisher's name of the associated application + /// + [JsonProperty(PropertyName = "publisherName")] + public string PublisherName { get; set; } + + /// + /// Gets or sets the URLs that user tokens are sent to for sign in with + /// the associated application. The redirect URIs that the oAuth 2.0 + /// authorization code and access tokens are sent to for the associated + /// application. + /// + [JsonProperty(PropertyName = "replyUrls")] + public IList ReplyUrls { get; set; } + + /// + /// Gets or sets the URL to the SAML metadata of the associated + /// application + /// + [JsonProperty(PropertyName = "samlMetadataUrl")] + public string SamlMetadataUrl { get; set; } + /// /// Gets or sets a collection of service principal names. /// [JsonProperty(PropertyName = "servicePrincipalNames")] public IList ServicePrincipalNames { get; set; } + /// + /// Gets or sets the type of the servie principal + /// + [JsonProperty(PropertyName = "servicePrincipalType")] + public string ServicePrincipalType { get; set; } + + /// + /// Gets or sets optional list of tags that you can apply to your + /// service principals. Not nullable. + /// + [JsonProperty(PropertyName = "tags")] + public IList Tags { get; set; } + } } diff --git a/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/Models/ServicePrincipalBase.cs b/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/Models/ServicePrincipalBase.cs new file mode 100644 index 000000000000..c6af6f90e8c8 --- /dev/null +++ b/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/Models/ServicePrincipalBase.cs @@ -0,0 +1,95 @@ +// +// 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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Graph.RBAC.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Active Directory service principal common perperties shared among GET, + /// POST and PATCH + /// + public partial class ServicePrincipalBase + { + /// + /// Initializes a new instance of the ServicePrincipalBase class. + /// + public ServicePrincipalBase() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ServicePrincipalBase class. + /// + /// The collection of key credentials + /// associated with the service principal. + /// The collection of password + /// credentials associated with the service principal. + /// the type of the servie + /// principal + /// whether or not the service principal + /// account is enabled + /// Optional list of tags that you can apply to your + /// service principals. Not nullable. + public ServicePrincipalBase(IList keyCredentials = default(IList), IList passwordCredentials = default(IList), string servicePrincipalType = default(string), string accountEnabled = default(string), IList tags = default(IList)) + { + KeyCredentials = keyCredentials; + PasswordCredentials = passwordCredentials; + ServicePrincipalType = servicePrincipalType; + AccountEnabled = accountEnabled; + Tags = tags; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the collection of key credentials associated with the + /// service principal. + /// + [JsonProperty(PropertyName = "keyCredentials")] + public IList KeyCredentials { get; set; } + + /// + /// Gets or sets the collection of password credentials associated with + /// the service principal. + /// + [JsonProperty(PropertyName = "passwordCredentials")] + public IList PasswordCredentials { get; set; } + + /// + /// Gets or sets the type of the servie principal + /// + [JsonProperty(PropertyName = "servicePrincipalType")] + public string ServicePrincipalType { get; set; } + + /// + /// Gets or sets whether or not the service principal account is + /// enabled + /// + [JsonProperty(PropertyName = "accountEnabled")] + public string AccountEnabled { get; set; } + + /// + /// Gets or sets optional list of tags that you can apply to your + /// service principals. Not nullable. + /// + [JsonProperty(PropertyName = "tags")] + public IList Tags { get; set; } + + } +} diff --git a/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/Models/ServicePrincipalCreateParameters.cs b/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/Models/ServicePrincipalCreateParameters.cs index 2f2728b01f45..8a5e2fc2d799 100644 --- a/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/Models/ServicePrincipalCreateParameters.cs +++ b/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/Models/ServicePrincipalCreateParameters.cs @@ -19,7 +19,7 @@ namespace Microsoft.Azure.Graph.RBAC.Models /// /// Request parameters for creating a new service principal. /// - public partial class ServicePrincipalCreateParameters + public partial class ServicePrincipalCreateParameters : ServicePrincipalBase { /// /// Initializes a new instance of the ServicePrincipalCreateParameters @@ -34,21 +34,21 @@ public ServicePrincipalCreateParameters() /// Initializes a new instance of the ServicePrincipalCreateParameters /// class. /// - /// application Id - /// Whether the account is enabled - /// Unmatched properties from the - /// message are deserialized this collection - /// A collection of KeyCredential - /// objects. - /// A collection of - /// PasswordCredential objects - public ServicePrincipalCreateParameters(string appId, bool accountEnabled, IDictionary additionalProperties = default(IDictionary), IList keyCredentials = default(IList), IList passwordCredentials = default(IList)) + /// The application ID. + /// The collection of key credentials + /// associated with the service principal. + /// The collection of password + /// credentials associated with the service principal. + /// the type of the servie + /// principal + /// whether or not the service principal + /// account is enabled + /// Optional list of tags that you can apply to your + /// service principals. Not nullable. + public ServicePrincipalCreateParameters(string appId, IList keyCredentials = default(IList), IList passwordCredentials = default(IList), string servicePrincipalType = default(string), string accountEnabled = default(string), IList tags = default(IList)) + : base(keyCredentials, passwordCredentials, servicePrincipalType, accountEnabled, tags) { - AdditionalProperties = additionalProperties; AppId = appId; - AccountEnabled = accountEnabled; - KeyCredentials = keyCredentials; - PasswordCredentials = passwordCredentials; CustomInit(); } @@ -58,36 +58,11 @@ public ServicePrincipalCreateParameters() partial void CustomInit(); /// - /// Gets or sets unmatched properties from the message are deserialized - /// this collection - /// - [JsonExtensionData] - public IDictionary AdditionalProperties { get; set; } - - /// - /// Gets or sets application Id + /// Gets or sets the application ID. /// [JsonProperty(PropertyName = "appId")] public string AppId { get; set; } - /// - /// Gets or sets whether the account is enabled - /// - [JsonProperty(PropertyName = "accountEnabled")] - public bool AccountEnabled { get; set; } - - /// - /// Gets or sets a collection of KeyCredential objects. - /// - [JsonProperty(PropertyName = "keyCredentials")] - public IList KeyCredentials { get; set; } - - /// - /// Gets or sets a collection of PasswordCredential objects - /// - [JsonProperty(PropertyName = "passwordCredentials")] - public IList PasswordCredentials { get; set; } - /// /// Validate the object. /// diff --git a/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/Models/ServicePrincipalUpdateParameters.cs b/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/Models/ServicePrincipalUpdateParameters.cs new file mode 100644 index 000000000000..ffd56d1272ab --- /dev/null +++ b/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/Models/ServicePrincipalUpdateParameters.cs @@ -0,0 +1,57 @@ +// +// 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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Graph.RBAC.Models +{ + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Request parameters for update an existing service principal. + /// + public partial class ServicePrincipalUpdateParameters : ServicePrincipalBase + { + /// + /// Initializes a new instance of the ServicePrincipalUpdateParameters + /// class. + /// + public ServicePrincipalUpdateParameters() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ServicePrincipalUpdateParameters + /// class. + /// + /// The collection of key credentials + /// associated with the service principal. + /// The collection of password + /// credentials associated with the service principal. + /// the type of the servie + /// principal + /// whether or not the service principal + /// account is enabled + /// Optional list of tags that you can apply to your + /// service principals. Not nullable. + public ServicePrincipalUpdateParameters(IList keyCredentials = default(IList), IList passwordCredentials = default(IList), string servicePrincipalType = default(string), string accountEnabled = default(string), IList tags = default(IList)) + : base(keyCredentials, passwordCredentials, servicePrincipalType, accountEnabled, tags) + { + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} diff --git a/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/OAuth2Operations.cs b/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/OAuth2Operations.cs index 22a19e5b5f0e..738573377700 100644 --- a/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/OAuth2Operations.cs +++ b/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/OAuth2Operations.cs @@ -51,7 +51,7 @@ internal OAuth2Operations(GraphRbacManagementClient client) public GraphRbacManagementClient Client { get; private set; } /// - /// Queries OAuth2 permissions for the relevant SP ObjectId of an app. + /// Queries OAuth2 permissions grants for the relevant SP ObjectId of an app. /// /// /// This is the Service Principal ObjectId associated with the app @@ -77,7 +77,7 @@ internal OAuth2Operations(GraphRbacManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetWithHttpMessagesAsync(string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> GetWithHttpMessagesAsync(string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.ApiVersion == null) { @@ -204,7 +204,7 @@ internal OAuth2Operations(GraphRbacManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -217,7 +217,7 @@ internal OAuth2Operations(GraphRbacManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -241,7 +241,7 @@ internal OAuth2Operations(GraphRbacManagementClient client) /// /// /// The relevant app Service Principal Object Id and the Service Principal - /// Objecit Id you want to grant. + /// Object Id you want to grant. /// /// /// Headers that will be added to request. @@ -264,7 +264,7 @@ internal OAuth2Operations(GraphRbacManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> PostWithHttpMessagesAsync(Permissions body = default(Permissions), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GrantWithHttpMessagesAsync(Permissions body = default(Permissions), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.ApiVersion == null) { @@ -283,7 +283,7 @@ internal OAuth2Operations(GraphRbacManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("body", body); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Post", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "Grant", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; @@ -425,5 +425,339 @@ internal OAuth2Operations(GraphRbacManagementClient client) return _result; } + /// + /// Delete a OAuth2 permission grant for the relevant resource Ids of an app. + /// + /// + /// The object ID of a permission grant. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task DeleteWithHttpMessagesAsync(string objectId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (objectId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "objectId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.TenantID == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.TenantID"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("objectId", objectId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{tenantID}/oauth2PermissionGrants/{objectId}").ToString(); + _url = _url.Replace("{objectId}", System.Uri.EscapeDataString(objectId)); + _url = _url.Replace("{tenantID}", System.Uri.EscapeDataString(Client.TenantID)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 204) + { + var ex = new GraphErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + GraphError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Queries OAuth2 permissions grants for the relevant SP ObjectId of an app. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> GetNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + } } diff --git a/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/OAuth2OperationsExtensions.cs b/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/OAuth2OperationsExtensions.cs index a35969d1eeab..bdb6ebfde331 100644 --- a/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/OAuth2OperationsExtensions.cs +++ b/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/OAuth2OperationsExtensions.cs @@ -22,7 +22,7 @@ namespace Microsoft.Azure.Graph.RBAC public static partial class OAuth2OperationsExtensions { /// - /// Queries OAuth2 permissions for the relevant SP ObjectId of an app. + /// Queries OAuth2 permissions grants for the relevant SP ObjectId of an app. /// /// /// The operations group for this extension method. @@ -30,13 +30,13 @@ public static partial class OAuth2OperationsExtensions /// /// This is the Service Principal ObjectId associated with the app /// - public static Permissions Get(this IOAuth2Operations operations, string filter = default(string)) + public static IPage Get(this IOAuth2Operations operations, string filter = default(string)) { return operations.GetAsync(filter).GetAwaiter().GetResult(); } /// - /// Queries OAuth2 permissions for the relevant SP ObjectId of an app. + /// Queries OAuth2 permissions grants for the relevant SP ObjectId of an app. /// /// /// The operations group for this extension method. @@ -47,7 +47,7 @@ public static partial class OAuth2OperationsExtensions /// /// The cancellation token. /// - public static async Task GetAsync(this IOAuth2Operations operations, string filter = default(string), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> GetAsync(this IOAuth2Operations operations, string filter = default(string), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetWithHttpMessagesAsync(filter, null, cancellationToken).ConfigureAwait(false)) { @@ -63,11 +63,11 @@ public static partial class OAuth2OperationsExtensions /// /// /// The relevant app Service Principal Object Id and the Service Principal - /// Objecit Id you want to grant. + /// Object Id you want to grant. /// - public static Permissions Post(this IOAuth2Operations operations, Permissions body = default(Permissions)) + public static Permissions Grant(this IOAuth2Operations operations, Permissions body = default(Permissions)) { - return operations.PostAsync(body).GetAwaiter().GetResult(); + return operations.GrantAsync(body).GetAwaiter().GetResult(); } /// @@ -78,14 +78,79 @@ public static partial class OAuth2OperationsExtensions /// /// /// The relevant app Service Principal Object Id and the Service Principal - /// Objecit Id you want to grant. + /// Object Id you want to grant. /// /// /// The cancellation token. /// - public static async Task PostAsync(this IOAuth2Operations operations, Permissions body = default(Permissions), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task GrantAsync(this IOAuth2Operations operations, Permissions body = default(Permissions), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.PostWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.GrantWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete a OAuth2 permission grant for the relevant resource Ids of an app. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The object ID of a permission grant. + /// + public static void Delete(this IOAuth2Operations operations, string objectId) + { + operations.DeleteAsync(objectId).GetAwaiter().GetResult(); + } + + /// + /// Delete a OAuth2 permission grant for the relevant resource Ids of an app. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The object ID of a permission grant. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IOAuth2Operations operations, string objectId, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(objectId, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Queries OAuth2 permissions grants for the relevant SP ObjectId of an app. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage GetNext(this IOAuth2Operations operations, string nextPageLink) + { + return operations.GetNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Queries OAuth2 permissions grants for the relevant SP ObjectId of an app. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> GetNextAsync(this IOAuth2Operations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } diff --git a/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/ObjectsOperations.cs b/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/ObjectsOperations.cs index c64b3c1ea43a..2a94e5453be1 100644 --- a/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/ObjectsOperations.cs +++ b/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/ObjectsOperations.cs @@ -51,180 +51,9 @@ internal ObjectsOperations(GraphRbacManagementClient client) public GraphRbacManagementClient Client { get; private set; } /// - /// Gets the details for the currently logged-in user. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task> GetCurrentUserWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } - if (Client.TenantID == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.TenantID"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "GetCurrentUser", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{tenantID}/me").ToString(); - _url = _url.Replace("{tenantID}", System.Uri.EscapeDataString(Client.TenantID)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new GraphErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - GraphError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Gets AD group membership for the specified AD object IDs. + /// Gets the directory objects specified in a list of object IDs. You can also + /// specify which resource collections (users, groups, etc.) should be searched + /// by specifying the optional types parameter. /// /// /// Objects filtering parameters. @@ -250,16 +79,12 @@ internal ObjectsOperations(GraphRbacManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> GetObjectsByObjectIdsWithHttpMessagesAsync(GetObjectsParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> GetObjectsByObjectIdsWithHttpMessagesAsync(GetObjectsParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (parameters == null) { throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); } - if (parameters != null) - { - parameters.Validate(); - } if (Client.ApiVersion == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); @@ -387,7 +212,7 @@ internal ObjectsOperations(GraphRbacManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -400,7 +225,7 @@ internal ObjectsOperations(GraphRbacManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -446,7 +271,7 @@ internal ObjectsOperations(GraphRbacManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> GetObjectsByObjectIdsNextWithHttpMessagesAsync(string nextLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> GetObjectsByObjectIdsNextWithHttpMessagesAsync(string nextLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (nextLink == null) { @@ -574,7 +399,7 @@ internal ObjectsOperations(GraphRbacManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -587,7 +412,7 @@ internal ObjectsOperations(GraphRbacManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { diff --git a/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/ObjectsOperationsExtensions.cs b/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/ObjectsOperationsExtensions.cs index 046c052a73e7..c88b181e28fc 100644 --- a/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/ObjectsOperationsExtensions.cs +++ b/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/ObjectsOperationsExtensions.cs @@ -22,35 +22,9 @@ namespace Microsoft.Azure.Graph.RBAC public static partial class ObjectsOperationsExtensions { /// - /// Gets the details for the currently logged-in user. - /// - /// - /// The operations group for this extension method. - /// - public static AADObject GetCurrentUser(this IObjectsOperations operations) - { - return operations.GetCurrentUserAsync().GetAwaiter().GetResult(); - } - - /// - /// Gets the details for the currently logged-in user. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The cancellation token. - /// - public static async Task GetCurrentUserAsync(this IObjectsOperations operations, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetCurrentUserWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Gets AD group membership for the specified AD object IDs. + /// Gets the directory objects specified in a list of object IDs. You can also + /// specify which resource collections (users, groups, etc.) should be searched + /// by specifying the optional types parameter. /// /// /// The operations group for this extension method. @@ -58,13 +32,15 @@ public static AADObject GetCurrentUser(this IObjectsOperations operations) /// /// Objects filtering parameters. /// - public static IPage GetObjectsByObjectIds(this IObjectsOperations operations, GetObjectsParameters parameters) + public static IPage GetObjectsByObjectIds(this IObjectsOperations operations, GetObjectsParameters parameters) { return operations.GetObjectsByObjectIdsAsync(parameters).GetAwaiter().GetResult(); } /// - /// Gets AD group membership for the specified AD object IDs. + /// Gets the directory objects specified in a list of object IDs. You can also + /// specify which resource collections (users, groups, etc.) should be searched + /// by specifying the optional types parameter. /// /// /// The operations group for this extension method. @@ -75,7 +51,7 @@ public static IPage GetObjectsByObjectIds(this IObjectsOperations ope /// /// The cancellation token. /// - public static async Task> GetObjectsByObjectIdsAsync(this IObjectsOperations operations, GetObjectsParameters parameters, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> GetObjectsByObjectIdsAsync(this IObjectsOperations operations, GetObjectsParameters parameters, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetObjectsByObjectIdsWithHttpMessagesAsync(parameters, null, cancellationToken).ConfigureAwait(false)) { @@ -92,7 +68,7 @@ public static IPage GetObjectsByObjectIds(this IObjectsOperations ope /// /// Next link for the list operation. /// - public static IPage GetObjectsByObjectIdsNext(this IObjectsOperations operations, string nextLink) + public static IPage GetObjectsByObjectIdsNext(this IObjectsOperations operations, string nextLink) { return operations.GetObjectsByObjectIdsNextAsync(nextLink).GetAwaiter().GetResult(); } @@ -109,7 +85,7 @@ public static IPage GetObjectsByObjectIdsNext(this IObjectsOperations /// /// The cancellation token. /// - public static async Task> GetObjectsByObjectIdsNextAsync(this IObjectsOperations operations, string nextLink, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> GetObjectsByObjectIdsNextAsync(this IObjectsOperations operations, string nextLink, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetObjectsByObjectIdsNextWithHttpMessagesAsync(nextLink, null, cancellationToken).ConfigureAwait(false)) { diff --git a/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/SdkInfo_GraphRbacManagementClient.cs b/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/SdkInfo_GraphRbacManagementClient.cs index e52aea33a3e1..fd506c4474b9 100644 --- a/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/SdkInfo_GraphRbacManagementClient.cs +++ b/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/SdkInfo_GraphRbacManagementClient.cs @@ -20,25 +20,16 @@ public static IEnumerable> ApiInfo_GraphRbacManage return new Tuple[] { new Tuple("GraphRbacManagementClient", "Applications", "1.6"), + new Tuple("GraphRbacManagementClient", "DeletedApplications", "1.6"), new Tuple("GraphRbacManagementClient", "Domains", "1.6"), new Tuple("GraphRbacManagementClient", "Groups", "1.6"), new Tuple("GraphRbacManagementClient", "OAuth2", "1.6"), new Tuple("GraphRbacManagementClient", "Objects", "1.6"), new Tuple("GraphRbacManagementClient", "ServicePrincipals", "1.6"), + new Tuple("GraphRbacManagementClient", "SignedInUser", "1.6"), new Tuple("GraphRbacManagementClient", "Users", "1.6"), }.AsEnumerable(); } } - // BEGIN: Code Generation Metadata Section - public static readonly String AutoRestVersion = "latest"; - public static readonly String AutoRestBootStrapperVersion = "autorest@2.0.4283"; - public static readonly String AutoRestCmdExecuted = "cmd.exe /c autorest.cmd https://github.com/Azure/azure-rest-api-specs/blob/master/specification/graphrbac/data-plane/readme.md --csharp --version=latest --reflect-api-versions --csharp-sdks-folder=C:\\Users\\grlin\\dev\\azure-sdk-for-net\\src\\SDKs"; - public static readonly String GithubForkName = "Azure"; - public static readonly String GithubBranchName = "master"; - public static readonly String GithubCommidId = "cd84ac9a998b7d39721b8c2675762e3df9bea628"; - public static readonly String CodeGenerationErrors = ""; - public static readonly String GithubRepoName = "azure-rest-api-specs"; - // END: Code Generation Metadata Section } } - diff --git a/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/ServicePrincipalsOperations.cs b/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/ServicePrincipalsOperations.cs index a0edf17268ee..8111d94f718f 100644 --- a/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/ServicePrincipalsOperations.cs +++ b/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/ServicePrincipalsOperations.cs @@ -427,6 +427,181 @@ internal ServicePrincipalsOperations(GraphRbacManagementClient client) return _result; } + /// + /// Updates a service principal in the directory. + /// + /// + /// The object ID of the service principal to delete. + /// + /// + /// Parameters to update a service principal. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task UpdateWithHttpMessagesAsync(string objectId, ServicePrincipalUpdateParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (objectId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "objectId"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.TenantID == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.TenantID"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("objectId", objectId); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{tenantID}/servicePrincipals/{objectId}").ToString(); + _url = _url.Replace("{objectId}", System.Uri.EscapeDataString(objectId)); + _url = _url.Replace("{tenantID}", System.Uri.EscapeDataString(Client.TenantID)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PATCH"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 204) + { + var ex = new GraphErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + GraphError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + /// /// Deletes a service principal from the directory. /// @@ -802,7 +977,7 @@ internal ServicePrincipalsOperations(GraphRbacManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListOwnersWithHttpMessagesAsync(string objectId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListOwnersWithHttpMessagesAsync(string objectId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (objectId == null) { @@ -925,7 +1100,7 @@ internal ServicePrincipalsOperations(GraphRbacManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -938,7 +1113,7 @@ internal ServicePrincipalsOperations(GraphRbacManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -1854,5 +2029,177 @@ internal ServicePrincipalsOperations(GraphRbacManagementClient client) return _result; } + /// + /// 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. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListOwnersNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListOwnersNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new GraphErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + GraphError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + } } diff --git a/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/ServicePrincipalsOperationsExtensions.cs b/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/ServicePrincipalsOperationsExtensions.cs index be9e54e24a9a..f884530b1b65 100644 --- a/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/ServicePrincipalsOperationsExtensions.cs +++ b/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/ServicePrincipalsOperationsExtensions.cs @@ -92,6 +92,43 @@ public static ServicePrincipal Create(this IServicePrincipalsOperations operatio } } + /// + /// Updates a service principal in the directory. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The object ID of the service principal to delete. + /// + /// + /// Parameters to update a service principal. + /// + public static void Update(this IServicePrincipalsOperations operations, string objectId, ServicePrincipalUpdateParameters parameters) + { + operations.UpdateAsync(objectId, parameters).GetAwaiter().GetResult(); + } + + /// + /// Updates a service principal in the directory. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The object ID of the service principal to delete. + /// + /// + /// Parameters to update a service principal. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this IServicePrincipalsOperations operations, string objectId, ServicePrincipalUpdateParameters parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.UpdateWithHttpMessagesAsync(objectId, parameters, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// /// Deletes a service principal from the directory. /// @@ -172,7 +209,7 @@ public static ServicePrincipal Get(this IServicePrincipalsOperations operations, /// /// The object ID of the service principal for which to get owners. /// - public static IEnumerable ListOwners(this IServicePrincipalsOperations operations, string objectId) + public static IPage ListOwners(this IServicePrincipalsOperations operations, string objectId) { return operations.ListOwnersAsync(objectId).GetAwaiter().GetResult(); } @@ -193,7 +230,7 @@ public static IEnumerable ListOwners(this IServicePrincipalsOpe /// /// The cancellation token. /// - public static async Task> ListOwnersAsync(this IServicePrincipalsOperations operations, string objectId, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListOwnersAsync(this IServicePrincipalsOperations operations, string objectId, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.ListOwnersWithHttpMessagesAsync(objectId, null, cancellationToken).ConfigureAwait(false)) { @@ -379,5 +416,47 @@ public static IPage ListNext(this IServicePrincipalsOperations } } + /// + /// 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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListOwnersNext(this IServicePrincipalsOperations operations, string nextPageLink) + { + return operations.ListOwnersNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// 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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListOwnersNextAsync(this IServicePrincipalsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListOwnersNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + } } diff --git a/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/SignedInUserOperations.cs b/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/SignedInUserOperations.cs new file mode 100644 index 000000000000..790c7b2befde --- /dev/null +++ b/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/SignedInUserOperations.cs @@ -0,0 +1,582 @@ +// +// 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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Graph.RBAC +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// SignedInUserOperations operations. + /// + internal partial class SignedInUserOperations : IServiceOperations, ISignedInUserOperations + { + /// + /// Initializes a new instance of the SignedInUserOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal SignedInUserOperations(GraphRbacManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the GraphRbacManagementClient + /// + public GraphRbacManagementClient Client { get; private set; } + + /// + /// Gets the details for the currently logged-in user. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.TenantID == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.TenantID"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{tenantID}/me").ToString(); + _url = _url.Replace("{tenantID}", System.Uri.EscapeDataString(Client.TenantID)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new GraphErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + GraphError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Get the list of directory objects that are owned by the user. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListOwnedObjectsWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.TenantID == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.TenantID"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListOwnedObjects", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{tenantID}/me/ownedObjects").ToString(); + _url = _url.Replace("{tenantID}", System.Uri.EscapeDataString(Client.TenantID)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new GraphErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + GraphError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Get the list of directory objects that are owned by the user. + /// + /// + /// Next link for the list operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListOwnedObjectsNextWithHttpMessagesAsync(string nextLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextLink"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.TenantID == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.TenantID"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextLink", nextLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListOwnedObjectsNext", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{tenantID}/{nextLink}").ToString(); + _url = _url.Replace("{nextLink}", nextLink); + _url = _url.Replace("{tenantID}", System.Uri.EscapeDataString(Client.TenantID)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new GraphErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + GraphError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/SignedInUserOperationsExtensions.cs b/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/SignedInUserOperationsExtensions.cs new file mode 100644 index 000000000000..3a38dfa59636 --- /dev/null +++ b/src/SDKs/Graph.RBAC/Graph.RBAC/Generated/SignedInUserOperationsExtensions.cs @@ -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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Graph.RBAC +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for SignedInUserOperations. + /// + public static partial class SignedInUserOperationsExtensions + { + /// + /// Gets the details for the currently logged-in user. + /// + /// + /// The operations group for this extension method. + /// + public static User Get(this ISignedInUserOperations operations) + { + return operations.GetAsync().GetAwaiter().GetResult(); + } + + /// + /// Gets the details for the currently logged-in user. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this ISignedInUserOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get the list of directory objects that are owned by the user. + /// + /// + /// The operations group for this extension method. + /// + public static IPage ListOwnedObjects(this ISignedInUserOperations operations) + { + return operations.ListOwnedObjectsAsync().GetAwaiter().GetResult(); + } + + /// + /// Get the list of directory objects that are owned by the user. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task> ListOwnedObjectsAsync(this ISignedInUserOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListOwnedObjectsWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get the list of directory objects that are owned by the user. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Next link for the list operation. + /// + public static IPage ListOwnedObjectsNext(this ISignedInUserOperations operations, string nextLink) + { + return operations.ListOwnedObjectsNextAsync(nextLink).GetAwaiter().GetResult(); + } + + /// + /// Get the list of directory objects that are owned by the user. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Next link for the list operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListOwnedObjectsNextAsync(this ISignedInUserOperations operations, string nextLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListOwnedObjectsNextWithHttpMessagesAsync(nextLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +}