Exemple #1
0
 /// <summary>
 /// Adds the specified VulnerableManagedDevice to the collection via POST.
 /// </summary>
 /// <param name="vulnerableManagedDevice">The VulnerableManagedDevice to add.</param>
 /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
 /// <returns>The created VulnerableManagedDevice.</returns>
 public System.Threading.Tasks.Task <VulnerableManagedDevice> AddAsync(VulnerableManagedDevice vulnerableManagedDevice, CancellationToken cancellationToken)
 {
     this.ContentType = "application/json";
     this.Method      = "POST";
     return(this.SendAsync <VulnerableManagedDevice>(vulnerableManagedDevice, cancellationToken));
 }
Exemple #2
0
 /// <summary>
 /// Adds the specified VulnerableManagedDevice to the collection via POST.
 /// </summary>
 /// <param name="vulnerableManagedDevice">The VulnerableManagedDevice to add.</param>
 /// <returns>The created VulnerableManagedDevice.</returns>
 public System.Threading.Tasks.Task <VulnerableManagedDevice> AddAsync(VulnerableManagedDevice vulnerableManagedDevice)
 {
     return(this.AddAsync(vulnerableManagedDevice, CancellationToken.None));
 }
Exemple #3
0
 /// <summary>
 /// Initializes any collection properties after deserialization, like next requests for paging.
 /// </summary>
 /// <param name="vulnerableManagedDeviceToInitialize">The <see cref="VulnerableManagedDevice"/> with the collection properties to initialize.</param>
 private void InitializeCollectionProperties(VulnerableManagedDevice vulnerableManagedDeviceToInitialize)
 {
 }
Exemple #4
0
        /// <summary>
        /// Creates the specified VulnerableManagedDevice using POST.
        /// </summary>
        /// <param name="vulnerableManagedDeviceToCreate">The VulnerableManagedDevice to create.</param>
        /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
        /// <returns>The created VulnerableManagedDevice.</returns>
        public async System.Threading.Tasks.Task <VulnerableManagedDevice> CreateAsync(VulnerableManagedDevice vulnerableManagedDeviceToCreate, CancellationToken cancellationToken)
        {
            this.ContentType = "application/json";
            this.Method      = "POST";
            var newEntity = await this.SendAsync <VulnerableManagedDevice>(vulnerableManagedDeviceToCreate, cancellationToken).ConfigureAwait(false);

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

            this.InitializeCollectionProperties(updatedEntity);
            return(updatedEntity);
        }