示例#1
0
        /// <summary>
        /// Creates the specified IosikEv2VpnConfiguration using POST.
        /// </summary>
        /// <param name="iosikEv2VpnConfigurationToCreate">The IosikEv2VpnConfiguration to create.</param>
        /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
        /// <returns>The created IosikEv2VpnConfiguration.</returns>
        public async System.Threading.Tasks.Task <IosikEv2VpnConfiguration> CreateAsync(IosikEv2VpnConfiguration iosikEv2VpnConfigurationToCreate, CancellationToken cancellationToken)
        {
            this.ContentType = "application/json";
            this.Method      = "POST";
            var newEntity = await this.SendAsync <IosikEv2VpnConfiguration>(iosikEv2VpnConfigurationToCreate, cancellationToken).ConfigureAwait(false);

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

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