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