/// <summary> /// Create a new table instance or update an existing instance. /// </summary> /// <param name='operations'> /// Reference to the /// Microsoft.Azure.Management.DataFactories.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> /// Create a new table instance or update an existing instance. /// </summary> /// <param name='operations'> /// Reference to the /// Microsoft.Azure.Management.DataFactories.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( s => ((ITableOperations)s).BeginCreateOrUpdateAsync(resourceGroupName, dataFactoryName, parameters), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult()); }
/// <summary> /// Serializes the given Table into JSON, by mocking a create or update request to /// exercise the client's serialization logic. /// </summary> /// <param name="item"></param> /// <returns></returns> public static string SerializeTableToJson(Table item) { var createParams = new TableCreateOrUpdateParameters() { Table = item }; var handler = new MockResourceProviderDelegatingHandler(); var client = DataPipelineManagementClient.GetFakeClient(handler); string resourceGroupName = Guid.NewGuid().ToString("D"); string dataFactoryName = Guid.NewGuid().ToString("D"); client.Tables.BeginCreateOrUpdate(resourceGroupName, dataFactoryName, createParams); return(handler.Json); }
private Core.Models.TableCreateOrUpdateParameters ValidateAndConvert(TableCreateOrUpdateParameters parameters) { // Validate Ensure.IsNotNull(parameters, "parameters"); Ensure.IsNotNull(parameters.Table, "parameters.Table"); this.ValidateObject(parameters.Table); // Convert Core.Models.Table internalTable = this.Converter.ToCoreType(parameters.Table); return(new Core.Models.TableCreateOrUpdateParameters() { Table = internalTable }); }
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)); }