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