/// <summary>
 /// Adds the specified UnifiedRbacResourceAction to the collection via POST.
 /// </summary>
 /// <param name="unifiedRbacResourceAction">The UnifiedRbacResourceAction to add.</param>
 /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
 /// <returns>The created UnifiedRbacResourceAction.</returns>
 public System.Threading.Tasks.Task <UnifiedRbacResourceAction> AddAsync(UnifiedRbacResourceAction unifiedRbacResourceAction, CancellationToken cancellationToken)
 {
     this.ContentType = "application/json";
     this.Method      = "POST";
     return(this.SendAsync <UnifiedRbacResourceAction>(unifiedRbacResourceAction, cancellationToken));
 }
 /// <summary>
 /// Adds the specified UnifiedRbacResourceAction to the collection via POST.
 /// </summary>
 /// <param name="unifiedRbacResourceAction">The UnifiedRbacResourceAction to add.</param>
 /// <returns>The created UnifiedRbacResourceAction.</returns>
 public System.Threading.Tasks.Task <UnifiedRbacResourceAction> AddAsync(UnifiedRbacResourceAction unifiedRbacResourceAction)
 {
     return(this.AddAsync(unifiedRbacResourceAction, CancellationToken.None));
 }
示例#3
0
        /// <summary>
        /// Creates the specified UnifiedRbacResourceAction using POST.
        /// </summary>
        /// <param name="unifiedRbacResourceActionToCreate">The UnifiedRbacResourceAction to create.</param>
        /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
        /// <returns>The created UnifiedRbacResourceAction.</returns>
        public async System.Threading.Tasks.Task <UnifiedRbacResourceAction> CreateAsync(UnifiedRbacResourceAction unifiedRbacResourceActionToCreate, CancellationToken cancellationToken)
        {
            this.ContentType = "application/json";
            this.Method      = "POST";
            var newEntity = await this.SendAsync <UnifiedRbacResourceAction>(unifiedRbacResourceActionToCreate, cancellationToken).ConfigureAwait(false);

            this.InitializeCollectionProperties(newEntity);
            return(newEntity);
        }
示例#4
0
 /// <summary>
 /// Creates the specified UnifiedRbacResourceAction using POST.
 /// </summary>
 /// <param name="unifiedRbacResourceActionToCreate">The UnifiedRbacResourceAction to create.</param>
 /// <returns>The created UnifiedRbacResourceAction.</returns>
 public System.Threading.Tasks.Task <UnifiedRbacResourceAction> CreateAsync(UnifiedRbacResourceAction unifiedRbacResourceActionToCreate)
 {
     return(this.CreateAsync(unifiedRbacResourceActionToCreate, CancellationToken.None));
 }
示例#5
0
 /// <summary>
 /// Initializes any collection properties after deserialization, like next requests for paging.
 /// </summary>
 /// <param name="unifiedRbacResourceActionToInitialize">The <see cref="UnifiedRbacResourceAction"/> with the collection properties to initialize.</param>
 private void InitializeCollectionProperties(UnifiedRbacResourceAction unifiedRbacResourceActionToInitialize)
 {
 }
示例#6
0
        /// <summary>
        /// Updates the specified UnifiedRbacResourceAction using PATCH.
        /// </summary>
        /// <param name="unifiedRbacResourceActionToUpdate">The UnifiedRbacResourceAction to update.</param>
        /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
        /// <exception cref="ClientException">Thrown when an object returned in a response is used for updating an object in Microsoft Graph.</exception>
        /// <returns>The updated UnifiedRbacResourceAction.</returns>
        public async System.Threading.Tasks.Task <UnifiedRbacResourceAction> UpdateAsync(UnifiedRbacResourceAction unifiedRbacResourceActionToUpdate, CancellationToken cancellationToken)
        {
            if (unifiedRbacResourceActionToUpdate.AdditionalData != null)
            {
                if (unifiedRbacResourceActionToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.ResponseHeaders) ||
                    unifiedRbacResourceActionToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.StatusCode))
                {
                    throw new ClientException(
                              new Error
                    {
                        Code    = GeneratedErrorConstants.Codes.NotAllowed,
                        Message = String.Format(GeneratedErrorConstants.Messages.ResponseObjectUsedForUpdate, unifiedRbacResourceActionToUpdate.GetType().Name)
                    });
                }
            }
            if (unifiedRbacResourceActionToUpdate.AdditionalData != null)
            {
                if (unifiedRbacResourceActionToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.ResponseHeaders) ||
                    unifiedRbacResourceActionToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.StatusCode))
                {
                    throw new ClientException(
                              new Error
                    {
                        Code    = GeneratedErrorConstants.Codes.NotAllowed,
                        Message = String.Format(GeneratedErrorConstants.Messages.ResponseObjectUsedForUpdate, unifiedRbacResourceActionToUpdate.GetType().Name)
                    });
                }
            }
            this.ContentType = "application/json";
            this.Method      = "PATCH";
            var updatedEntity = await this.SendAsync <UnifiedRbacResourceAction>(unifiedRbacResourceActionToUpdate, cancellationToken).ConfigureAwait(false);

            this.InitializeCollectionProperties(updatedEntity);
            return(updatedEntity);
        }