/// <summary>
 /// Create or update a data factory linkedService.
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.Azure.Management.DataFactories.Core.ILinkedServiceOperations.
 /// </param>
 /// <param name='resourceGroupName'>
 /// Required. The resource group name of the data factory.
 /// </param>
 /// <param name='dataFactoryName'>
 /// Required. The name of the data factory.
 /// </param>
 /// <param name='parameters'>
 /// Required. The parameters required to create or update a data
 /// factory linkedService.
 /// </param>
 /// <returns>
 /// The create or update data factory linkedService operation response.
 /// </returns>
 public static LinkedServiceCreateOrUpdateResponse BeginCreateOrUpdate(this ILinkedServiceOperations operations, string resourceGroupName, string dataFactoryName, LinkedServiceCreateOrUpdateParameters parameters)
 {
     return Task.Factory.StartNew((object s) => 
     {
         return ((ILinkedServiceOperations)s).BeginCreateOrUpdateAsync(resourceGroupName, dataFactoryName, parameters);
     }
     , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
 }
        /// <summary>
        /// Serializes the given InternalLinkedService into JSON, by mocking a create request to
        /// exercise the client's serialization logic.
        /// </summary>
        /// <param name="item">The object to serialize.</param>
        /// <returns></returns>
        internal static string SerializeInternalLinkedServiceToJson(Models.LinkedService item)
        {
            var createParams = new Models.LinkedServiceCreateOrUpdateParameters()
            {
                LinkedService = item
            };

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

            client.LinkedServices.BeginCreateOrUpdate(resourceGroupName, dataFactoryName, createParams);
            return(handler.Json);
        }
Example #3
0
        public async Task <LinkedServiceCreateOrUpdateResponse> BeginCreateOrUpdateAsync(
            string resourceGroupName,
            string dataFactoryName,
            LinkedServiceCreateOrUpdateParameters parameters,
            CancellationToken cancellationToken)
        {
            Core.Models.LinkedServiceCreateOrUpdateParameters internalParameters = this.ValidateAndConvert(parameters);

            Core.Models.LinkedServiceCreateOrUpdateResponse response =
                await this.Client.InternalClient.LinkedServices.BeginCreateOrUpdateAsync(
                    resourceGroupName,
                    dataFactoryName,
                    internalParameters,
                    cancellationToken);

            return(new LinkedServiceCreateOrUpdateResponse(response, this.Client));
        }
        /// <summary>
        /// Serializes the given InternalLinkedService into JSON, by mocking a create request to 
        /// exercise the client's serialization logic.
        /// </summary>
        /// <param name="item">The object to serialize.</param>
        /// <returns></returns>
        internal static string SerializeInternalLinkedServiceToJson(Models.LinkedService item)
        {
            var createParams = new Models.LinkedServiceCreateOrUpdateParameters() { LinkedService = item };

            var handler = new MockResourceProviderDelegatingHandler();
            var client = GetFakeClient(handler);
            string resourceGroupName = Guid.NewGuid().ToString("D");
            string dataFactoryName = Guid.NewGuid().ToString("D");
            client.LinkedServices.BeginCreateOrUpdate(resourceGroupName, dataFactoryName, createParams);
            return handler.Json;
        }
 /// <summary>
 /// Create or update a data factory linkedService.
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.Azure.Management.DataFactories.Core.ILinkedServiceOperations.
 /// </param>
 /// <param name='resourceGroupName'>
 /// Required. The resource group name of the data factory.
 /// </param>
 /// <param name='dataFactoryName'>
 /// Required. The name of the data factory.
 /// </param>
 /// <param name='parameters'>
 /// Required. The parameters required to create or update a data
 /// factory linkedService.
 /// </param>
 /// <returns>
 /// The create or update data factory linkedService operation response.
 /// </returns>
 public static Task<LinkedServiceCreateOrUpdateResponse> BeginCreateOrUpdateAsync(this ILinkedServiceOperations operations, string resourceGroupName, string dataFactoryName, LinkedServiceCreateOrUpdateParameters parameters)
 {
     return operations.BeginCreateOrUpdateAsync(resourceGroupName, dataFactoryName, parameters, CancellationToken.None);
 }