public async Task <StreamingJob> GetJobAsync(string saJobName)
        {
            IStreamAnalyticsManagementClient client = await this.GetClientAsync();

            try
            {
                return(await client.StreamingJobs.GetAsync(this.config.Global.ResourceGroup, saJobName));
            }
            catch (CloudException ce)
            {
                if (ce.Message.ToLower().Contains("was not found"))
                {
                    // Ensure that this cloud exception is for a resource not found exception
                    throw new ResourceNotFoundException($"The stream analytics job {saJobName} does not exist or could not be found.", ce);
                }
                else
                {
                    // otherwise, just throw the cloud exception.
                    throw ce;
                }
            }
            catch (Exception e)
            {
                throw new Exception($"An Unknown Exception occurred while attempting to get the stream analytics job {saJobName}", e);
            }
        }
Пример #2
0
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.Azure.Management.StreamAnalytics.IStreamAnalyticsManagementClient.
 /// </param>
 /// <param name='operationStatusLink'>
 /// Required. Location value returned by the Begin operation.
 /// </param>
 /// <returns>
 /// The test result of the input or output data source.
 /// </returns>
 public static ResourceTestConnectionResponse GetTestConnectionStatus(this IStreamAnalyticsManagementClient operations, string operationStatusLink)
 {
     return(Task.Factory.StartNew((object s) =>
     {
         return ((IStreamAnalyticsManagementClient)s).GetTestConnectionStatusAsync(operationStatusLink);
     }
                                  , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult());
 }
        public async Task StopAsync(string saJobName)
        {
            IStreamAnalyticsManagementClient client = await this.GetClientAsync();

            try
            {
                await client.StreamingJobs.BeginStopAsync(this.config.Global.ResourceGroup, saJobName);
            }
            catch (Exception e)
            {
                throw new Exception($"Unable to stop the Stream Analytics Job {saJobName}.", e);
            }
        }
        public async Task <StatusResultServiceModel> StatusAsync()
        {
            try
            {
                IStreamAnalyticsManagementClient client = await this.GetClientAsync();

                return(new StatusResultServiceModel(true, "Alive and well!"));
            }
            catch (Exception e)
            {
                return(new StatusResultServiceModel(false, $"Unable to get the status of Stream Analytics: {e.Message}"));
            }
        }
 public StreamAnalyticsClient(AzureContext context)
 {
     StreamAnalyticsManagementClient = AzureSession.ClientFactory.CreateClient<StreamAnalyticsManagementClient>(
         context, AzureEnvironment.Endpoint.ResourceManager);
 }
 public StreamAnalyticsClient(AzureContext context)
 {
     StreamAnalyticsManagementClient = AzureSession.ClientFactory.CreateClient <StreamAnalyticsManagementClient>(
         context, AzureEnvironment.Endpoint.ResourceManager);
 }
Пример #7
0
 /// <summary>
 /// The Get Operation Status operation returns the status of the
 /// specified operation. After calling an asynchronous operation, you
 /// can call Get Operation Status to determine whether the operation
 /// has succeeded, failed, or is still in progress.
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.Azure.Management.StreamAnalytics.IStreamAnalyticsManagementClient.
 /// </param>
 /// <param name='operationStatusLink'>
 /// Required. Location value returned by the Begin operation.
 /// </param>
 /// <returns>
 /// A standard service response for long running operations.
 /// </returns>
 public static Task <LongRunningOperationResponse> GetLongRunningOperationStatusAsync(this IStreamAnalyticsManagementClient operations, string operationStatusLink)
 {
     return(operations.GetLongRunningOperationStatusAsync(operationStatusLink, CancellationToken.None));
 }
Пример #8
0
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.Azure.Management.StreamAnalytics.IStreamAnalyticsManagementClient.
 /// </param>
 /// <param name='operationStatusLink'>
 /// Required. Location value returned by the Begin operation.
 /// </param>
 /// <returns>
 /// The test result of the input or output data source.
 /// </returns>
 public static Task <ResourceTestConnectionResponse> GetTestConnectionStatusAsync(this IStreamAnalyticsManagementClient operations, string operationStatusLink)
 {
     return(operations.GetTestConnectionStatusAsync(operationStatusLink, CancellationToken.None));
 }