/// <summary> /// Initializes any collection properties after deserialization, like next requests for paging. /// </summary> /// <param name="windowsDefenderApplicationControlSupplementalPolicyToInitialize">The <see cref="WindowsDefenderApplicationControlSupplementalPolicy"/> with the collection properties to initialize.</param> private void InitializeCollectionProperties(WindowsDefenderApplicationControlSupplementalPolicy windowsDefenderApplicationControlSupplementalPolicyToInitialize) { if (windowsDefenderApplicationControlSupplementalPolicyToInitialize != null && windowsDefenderApplicationControlSupplementalPolicyToInitialize.AdditionalData != null) { if (windowsDefenderApplicationControlSupplementalPolicyToInitialize.Assignments != null && windowsDefenderApplicationControlSupplementalPolicyToInitialize.Assignments.CurrentPage != null) { windowsDefenderApplicationControlSupplementalPolicyToInitialize.Assignments.AdditionalData = windowsDefenderApplicationControlSupplementalPolicyToInitialize.AdditionalData; object nextPageLink; windowsDefenderApplicationControlSupplementalPolicyToInitialize.AdditionalData.TryGetValue("*****@*****.**", out nextPageLink); var nextPageLinkString = nextPageLink as string; if (!string.IsNullOrEmpty(nextPageLinkString)) { windowsDefenderApplicationControlSupplementalPolicyToInitialize.Assignments.InitializeNextPageRequest( this.Client, nextPageLinkString); } } if (windowsDefenderApplicationControlSupplementalPolicyToInitialize.DeviceStatuses != null && windowsDefenderApplicationControlSupplementalPolicyToInitialize.DeviceStatuses.CurrentPage != null) { windowsDefenderApplicationControlSupplementalPolicyToInitialize.DeviceStatuses.AdditionalData = windowsDefenderApplicationControlSupplementalPolicyToInitialize.AdditionalData; object nextPageLink; windowsDefenderApplicationControlSupplementalPolicyToInitialize.AdditionalData.TryGetValue("*****@*****.**", out nextPageLink); var nextPageLinkString = nextPageLink as string; if (!string.IsNullOrEmpty(nextPageLinkString)) { windowsDefenderApplicationControlSupplementalPolicyToInitialize.DeviceStatuses.InitializeNextPageRequest( this.Client, nextPageLinkString); } } } }
/// <summary> /// Updates the specified WindowsDefenderApplicationControlSupplementalPolicy using PATCH. /// </summary> /// <param name="windowsDefenderApplicationControlSupplementalPolicyToUpdate">The WindowsDefenderApplicationControlSupplementalPolicy to update.</param> /// <returns>The updated WindowsDefenderApplicationControlSupplementalPolicy.</returns> public System.Threading.Tasks.Task <WindowsDefenderApplicationControlSupplementalPolicy> UpdateAsync(WindowsDefenderApplicationControlSupplementalPolicy windowsDefenderApplicationControlSupplementalPolicyToUpdate) { return(this.UpdateAsync(windowsDefenderApplicationControlSupplementalPolicyToUpdate, CancellationToken.None)); }
/// <summary> /// Creates the specified WindowsDefenderApplicationControlSupplementalPolicy using POST. /// </summary> /// <param name="windowsDefenderApplicationControlSupplementalPolicyToCreate">The WindowsDefenderApplicationControlSupplementalPolicy to create.</param> /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param> /// <returns>The created WindowsDefenderApplicationControlSupplementalPolicy.</returns> public async System.Threading.Tasks.Task <WindowsDefenderApplicationControlSupplementalPolicy> CreateAsync(WindowsDefenderApplicationControlSupplementalPolicy windowsDefenderApplicationControlSupplementalPolicyToCreate, CancellationToken cancellationToken) { this.ContentType = "application/json"; this.Method = "POST"; var newEntity = await this.SendAsync <WindowsDefenderApplicationControlSupplementalPolicy>(windowsDefenderApplicationControlSupplementalPolicyToCreate, cancellationToken).ConfigureAwait(false); return(newEntity); }
/// <summary> /// Updates the specified WindowsDefenderApplicationControlSupplementalPolicy using PATCH. /// </summary> /// <param name="windowsDefenderApplicationControlSupplementalPolicyToUpdate">The WindowsDefenderApplicationControlSupplementalPolicy 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 WindowsDefenderApplicationControlSupplementalPolicy.</returns> public async System.Threading.Tasks.Task <WindowsDefenderApplicationControlSupplementalPolicy> UpdateAsync(WindowsDefenderApplicationControlSupplementalPolicy windowsDefenderApplicationControlSupplementalPolicyToUpdate, CancellationToken cancellationToken) { if (windowsDefenderApplicationControlSupplementalPolicyToUpdate.AdditionalData != null) { if (windowsDefenderApplicationControlSupplementalPolicyToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.ResponseHeaders) || windowsDefenderApplicationControlSupplementalPolicyToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.StatusCode)) { throw new ClientException( new Error { Code = GeneratedErrorConstants.Codes.NotAllowed, Message = String.Format(GeneratedErrorConstants.Messages.ResponseObjectUsedForUpdate, windowsDefenderApplicationControlSupplementalPolicyToUpdate.GetType().Name) }); } } if (windowsDefenderApplicationControlSupplementalPolicyToUpdate.AdditionalData != null) { if (windowsDefenderApplicationControlSupplementalPolicyToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.ResponseHeaders) || windowsDefenderApplicationControlSupplementalPolicyToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.StatusCode)) { throw new ClientException( new Error { Code = GeneratedErrorConstants.Codes.NotAllowed, Message = String.Format(GeneratedErrorConstants.Messages.ResponseObjectUsedForUpdate, windowsDefenderApplicationControlSupplementalPolicyToUpdate.GetType().Name) }); } } this.ContentType = "application/json"; this.Method = "PATCH"; var updatedEntity = await this.SendAsync <WindowsDefenderApplicationControlSupplementalPolicy>(windowsDefenderApplicationControlSupplementalPolicyToUpdate, cancellationToken).ConfigureAwait(false); return(updatedEntity); }
/// <summary> /// Adds the specified WindowsDefenderApplicationControlSupplementalPolicy to the collection via POST. /// </summary> /// <param name="windowsDefenderApplicationControlSupplementalPolicy">The WindowsDefenderApplicationControlSupplementalPolicy to add.</param> /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param> /// <returns>The created WindowsDefenderApplicationControlSupplementalPolicy.</returns> public System.Threading.Tasks.Task <WindowsDefenderApplicationControlSupplementalPolicy> AddAsync(WindowsDefenderApplicationControlSupplementalPolicy windowsDefenderApplicationControlSupplementalPolicy, CancellationToken cancellationToken) { this.ContentType = "application/json"; this.Method = "POST"; return(this.SendAsync <WindowsDefenderApplicationControlSupplementalPolicy>(windowsDefenderApplicationControlSupplementalPolicy, cancellationToken)); }