/// <summary> /// Adds the specified WindowsDefenderApplicationControlSupplementalPolicyAssignment to the collection via POST. /// </summary> /// <param name="windowsDefenderApplicationControlSupplementalPolicyAssignment">The WindowsDefenderApplicationControlSupplementalPolicyAssignment to add.</param> /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param> /// <returns>The created WindowsDefenderApplicationControlSupplementalPolicyAssignment.</returns> public System.Threading.Tasks.Task <WindowsDefenderApplicationControlSupplementalPolicyAssignment> AddAsync(WindowsDefenderApplicationControlSupplementalPolicyAssignment windowsDefenderApplicationControlSupplementalPolicyAssignment, CancellationToken cancellationToken) { this.ContentType = "application/json"; this.Method = "POST"; return(this.SendAsync <WindowsDefenderApplicationControlSupplementalPolicyAssignment>(windowsDefenderApplicationControlSupplementalPolicyAssignment, cancellationToken)); }
/// <summary> /// Adds the specified WindowsDefenderApplicationControlSupplementalPolicyAssignment to the collection via POST. /// </summary> /// <param name="windowsDefenderApplicationControlSupplementalPolicyAssignment">The WindowsDefenderApplicationControlSupplementalPolicyAssignment to add.</param> /// <returns>The created WindowsDefenderApplicationControlSupplementalPolicyAssignment.</returns> public System.Threading.Tasks.Task <WindowsDefenderApplicationControlSupplementalPolicyAssignment> AddAsync(WindowsDefenderApplicationControlSupplementalPolicyAssignment windowsDefenderApplicationControlSupplementalPolicyAssignment) { return(this.AddAsync(windowsDefenderApplicationControlSupplementalPolicyAssignment, CancellationToken.None)); }
/// <summary> /// Initializes any collection properties after deserialization, like next requests for paging. /// </summary> /// <param name="windowsDefenderApplicationControlSupplementalPolicyAssignmentToInitialize">The <see cref="WindowsDefenderApplicationControlSupplementalPolicyAssignment"/> with the collection properties to initialize.</param> private void InitializeCollectionProperties(WindowsDefenderApplicationControlSupplementalPolicyAssignment windowsDefenderApplicationControlSupplementalPolicyAssignmentToInitialize) { }
/// <summary> /// Creates the specified WindowsDefenderApplicationControlSupplementalPolicyAssignment using POST. /// </summary> /// <param name="windowsDefenderApplicationControlSupplementalPolicyAssignmentToCreate">The WindowsDefenderApplicationControlSupplementalPolicyAssignment to create.</param> /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param> /// <returns>The created WindowsDefenderApplicationControlSupplementalPolicyAssignment.</returns> public async System.Threading.Tasks.Task <WindowsDefenderApplicationControlSupplementalPolicyAssignment> CreateAsync(WindowsDefenderApplicationControlSupplementalPolicyAssignment windowsDefenderApplicationControlSupplementalPolicyAssignmentToCreate, CancellationToken cancellationToken) { this.ContentType = "application/json"; this.Method = "POST"; var newEntity = await this.SendAsync <WindowsDefenderApplicationControlSupplementalPolicyAssignment>(windowsDefenderApplicationControlSupplementalPolicyAssignmentToCreate, cancellationToken).ConfigureAwait(false); this.InitializeCollectionProperties(newEntity); return(newEntity); }
/// <summary> /// Updates the specified WindowsDefenderApplicationControlSupplementalPolicyAssignment using PATCH. /// </summary> /// <param name="windowsDefenderApplicationControlSupplementalPolicyAssignmentToUpdate">The WindowsDefenderApplicationControlSupplementalPolicyAssignment 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 WindowsDefenderApplicationControlSupplementalPolicyAssignment.</returns> public async System.Threading.Tasks.Task <WindowsDefenderApplicationControlSupplementalPolicyAssignment> UpdateAsync(WindowsDefenderApplicationControlSupplementalPolicyAssignment windowsDefenderApplicationControlSupplementalPolicyAssignmentToUpdate, CancellationToken cancellationToken) { if (windowsDefenderApplicationControlSupplementalPolicyAssignmentToUpdate.AdditionalData != null) { if (windowsDefenderApplicationControlSupplementalPolicyAssignmentToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.ResponseHeaders) || windowsDefenderApplicationControlSupplementalPolicyAssignmentToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.StatusCode)) { throw new ClientException( new Error { Code = GeneratedErrorConstants.Codes.NotAllowed, Message = String.Format(GeneratedErrorConstants.Messages.ResponseObjectUsedForUpdate, windowsDefenderApplicationControlSupplementalPolicyAssignmentToUpdate.GetType().Name) }); } } if (windowsDefenderApplicationControlSupplementalPolicyAssignmentToUpdate.AdditionalData != null) { if (windowsDefenderApplicationControlSupplementalPolicyAssignmentToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.ResponseHeaders) || windowsDefenderApplicationControlSupplementalPolicyAssignmentToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.StatusCode)) { throw new ClientException( new Error { Code = GeneratedErrorConstants.Codes.NotAllowed, Message = String.Format(GeneratedErrorConstants.Messages.ResponseObjectUsedForUpdate, windowsDefenderApplicationControlSupplementalPolicyAssignmentToUpdate.GetType().Name) }); } } this.ContentType = "application/json"; this.Method = "PATCH"; var updatedEntity = await this.SendAsync <WindowsDefenderApplicationControlSupplementalPolicyAssignment>(windowsDefenderApplicationControlSupplementalPolicyAssignmentToUpdate, cancellationToken).ConfigureAwait(false); this.InitializeCollectionProperties(updatedEntity); return(updatedEntity); }