/// <summary>
 /// Create a new table instance or update an existing instance.
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.Azure.Management.DataFactories.Core.ITableOperations.
 /// </param>
 /// <param name='resourceGroupName'>
 /// Required. The resource group name of the data factory.
 /// </param>
 /// <param name='dataFactoryName'>
 /// Required. A unique data factory instance name.
 /// </param>
 /// <param name='parameters'>
 /// Required. The parameters required to create or update a table.
 /// </param>
 /// <returns>
 /// The CreateOrUpdate table operation response.
 /// </returns>
 public static TableCreateOrUpdateResponse BeginCreateOrUpdate(this ITableOperations operations, string resourceGroupName, string dataFactoryName, TableCreateOrUpdateParameters parameters)
 {
     return Task.Factory.StartNew((object s) => 
     {
         return ((ITableOperations)s).BeginCreateOrUpdateAsync(resourceGroupName, dataFactoryName, parameters);
     }
     , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Serializes the given Core.Models.Table into JSON, by mocking a create or update request to
        /// exercise the client's serialization logic.
        /// </summary>
        /// <param name="item">The object to serialize.</param>
        /// <returns></returns>
        internal static string SerializeInternalTableToJson(Models.Table item)
        {
            var createParams = new Models.TableCreateOrUpdateParameters()
            {
                Table = item
            };

            var    handler           = new MockResourceProviderDelegatingHandler();
            var    client            = GetFakeClient(handler);
            string resourceGroupName = Guid.NewGuid().ToString("D");
            string dataFactoryName   = Guid.NewGuid().ToString("D");

            client.Tables.BeginCreateOrUpdate(resourceGroupName, dataFactoryName, createParams);
            return(handler.Json);
        }
Ejemplo n.º 3
0
        public async Task <TableCreateOrUpdateResponse> BeginCreateOrUpdateAsync(
            string resourceGroupName,
            string dataFactoryName,
            TableCreateOrUpdateParameters parameters,
            CancellationToken cancellationToken)
        {
            Core.Models.TableCreateOrUpdateParameters internalParameters = this.ValidateAndConvert(parameters);

            var response = await this.Client.InternalClient.Tables.BeginCreateOrUpdateAsync(
                resourceGroupName,
                dataFactoryName,
                internalParameters,
                cancellationToken);

            return(new TableCreateOrUpdateResponse(response, this.Client));
        }
 /// <summary>
 /// Create a new table instance or update an existing instance.
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.Azure.Management.DataFactories.Core.ITableOperations.
 /// </param>
 /// <param name='resourceGroupName'>
 /// Required. The resource group name of the data factory.
 /// </param>
 /// <param name='dataFactoryName'>
 /// Required. A unique data factory instance name.
 /// </param>
 /// <param name='parameters'>
 /// Required. The parameters required to create or update a table.
 /// </param>
 /// <returns>
 /// The CreateOrUpdate table operation response.
 /// </returns>
 public static Task<TableCreateOrUpdateResponse> BeginCreateOrUpdateAsync(this ITableOperations operations, string resourceGroupName, string dataFactoryName, TableCreateOrUpdateParameters parameters)
 {
     return operations.BeginCreateOrUpdateAsync(resourceGroupName, dataFactoryName, parameters, CancellationToken.None);
 }
        /// <summary>
        /// Serializes the given Core.Models.Table into JSON, by mocking a create or update request to 
        /// exercise the client's serialization logic.
        /// </summary>
        /// <param name="item">The object to serialize.</param>
        /// <returns></returns>
        internal static string SerializeInternalTableToJson(Models.Table item)
        {
            var createParams = new Models.TableCreateOrUpdateParameters() { Table = item };

            var handler = new MockResourceProviderDelegatingHandler();
            var client = GetFakeClient(handler);
            string resourceGroupName = Guid.NewGuid().ToString("D");
            string dataFactoryName = Guid.NewGuid().ToString("D");
            client.Tables.BeginCreateOrUpdate(resourceGroupName, dataFactoryName, createParams);
            return handler.Json;
        }