Exemple #1
0
        /// <summary>
        /// Updates the specified BitlockerRecoveryKey using PATCH.
        /// </summary>
        /// <param name="bitlockerRecoveryKeyToUpdate">The BitlockerRecoveryKey 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 BitlockerRecoveryKey.</returns>
        public async System.Threading.Tasks.Task <BitlockerRecoveryKey> UpdateAsync(BitlockerRecoveryKey bitlockerRecoveryKeyToUpdate, CancellationToken cancellationToken)
        {
            if (bitlockerRecoveryKeyToUpdate.AdditionalData != null)
            {
                if (bitlockerRecoveryKeyToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.ResponseHeaders) ||
                    bitlockerRecoveryKeyToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.StatusCode))
                {
                    throw new ClientException(
                              new Error
                    {
                        Code    = GeneratedErrorConstants.Codes.NotAllowed,
                        Message = String.Format(GeneratedErrorConstants.Messages.ResponseObjectUsedForUpdate, bitlockerRecoveryKeyToUpdate.GetType().Name)
                    });
                }
            }
            if (bitlockerRecoveryKeyToUpdate.AdditionalData != null)
            {
                if (bitlockerRecoveryKeyToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.ResponseHeaders) ||
                    bitlockerRecoveryKeyToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.StatusCode))
                {
                    throw new ClientException(
                              new Error
                    {
                        Code    = GeneratedErrorConstants.Codes.NotAllowed,
                        Message = String.Format(GeneratedErrorConstants.Messages.ResponseObjectUsedForUpdate, bitlockerRecoveryKeyToUpdate.GetType().Name)
                    });
                }
            }
            this.ContentType = "application/json";
            this.Method      = "PATCH";
            var updatedEntity = await this.SendAsync <BitlockerRecoveryKey>(bitlockerRecoveryKeyToUpdate, cancellationToken).ConfigureAwait(false);

            this.InitializeCollectionProperties(updatedEntity);
            return(updatedEntity);
        }
Exemple #2
0
        /// <summary>
        /// Creates the specified BitlockerRecoveryKey using POST.
        /// </summary>
        /// <param name="bitlockerRecoveryKeyToCreate">The BitlockerRecoveryKey to create.</param>
        /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
        /// <returns>The created BitlockerRecoveryKey.</returns>
        public async System.Threading.Tasks.Task <BitlockerRecoveryKey> CreateAsync(BitlockerRecoveryKey bitlockerRecoveryKeyToCreate, CancellationToken cancellationToken)
        {
            this.ContentType = "application/json";
            this.Method      = "POST";
            var newEntity = await this.SendAsync <BitlockerRecoveryKey>(bitlockerRecoveryKeyToCreate, cancellationToken).ConfigureAwait(false);

            this.InitializeCollectionProperties(newEntity);
            return(newEntity);
        }
 /// <summary>
 /// Adds the specified BitlockerRecoveryKey to the collection via POST.
 /// </summary>
 /// <param name="bitlockerRecoveryKey">The BitlockerRecoveryKey to add.</param>
 /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
 /// <returns>The created BitlockerRecoveryKey.</returns>
 public System.Threading.Tasks.Task <BitlockerRecoveryKey> AddAsync(BitlockerRecoveryKey bitlockerRecoveryKey, CancellationToken cancellationToken)
 {
     this.ContentType = "application/json";
     this.Method      = "POST";
     return(this.SendAsync <BitlockerRecoveryKey>(bitlockerRecoveryKey, cancellationToken));
 }
 /// <summary>
 /// Adds the specified BitlockerRecoveryKey to the collection via POST.
 /// </summary>
 /// <param name="bitlockerRecoveryKey">The BitlockerRecoveryKey to add.</param>
 /// <returns>The created BitlockerRecoveryKey.</returns>
 public System.Threading.Tasks.Task <BitlockerRecoveryKey> AddAsync(BitlockerRecoveryKey bitlockerRecoveryKey)
 {
     return(this.AddAsync(bitlockerRecoveryKey, CancellationToken.None));
 }
Exemple #5
0
 /// <summary>
 /// Creates the specified BitlockerRecoveryKey using POST.
 /// </summary>
 /// <param name="bitlockerRecoveryKeyToCreate">The BitlockerRecoveryKey to create.</param>
 /// <returns>The created BitlockerRecoveryKey.</returns>
 public System.Threading.Tasks.Task <BitlockerRecoveryKey> CreateAsync(BitlockerRecoveryKey bitlockerRecoveryKeyToCreate)
 {
     return(this.CreateAsync(bitlockerRecoveryKeyToCreate, CancellationToken.None));
 }
Exemple #6
0
 /// <summary>
 /// Initializes any collection properties after deserialization, like next requests for paging.
 /// </summary>
 /// <param name="bitlockerRecoveryKeyToInitialize">The <see cref="BitlockerRecoveryKey"/> with the collection properties to initialize.</param>
 private void InitializeCollectionProperties(BitlockerRecoveryKey bitlockerRecoveryKeyToInitialize)
 {
 }