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