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