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