Esempio n. 1
0
        private void SetupTelemetryDataSinkMetadataRegistry(ISettingOperations settingOperations)
        {
            var telemetryDataSinkSetupServiceClient = _serviceProvider.GetService <ITelemetryDataSinkSetupServiceClient>();

            telemetryDataSinkSetupServiceClient.Setup(settingOperations.Get(Setting.TelemetrySetupServiceEndpoint).Value,
                                                      settingOperations.Get(Setting.TelemetrySetupServiceApiKey).Value);

            var telemetryDataSinkMetadataRegistry = (TelemetryDataSinkMetadataRegistry)_serviceProvider.GetService <ITelemetryDataSinkMetadataRegistry>();
            var telemetryDataSinksMetadata        = telemetryDataSinkSetupServiceClient.GetTelemetryDataSinksMetadata();

            var telemeryDataSection = new TelemetryDataSection
            {
                Incoming = telemetryDataSinksMetadata.Incoming.Select(inc =>
                                                                      new TelemetryDataSinkElement
                {
                    Name             = inc.Name,
                    Type             = inc.TypeName,
                    Description      = inc.Description,
                    ParameterPresets = inc.ParametersPresets?.Select(pp =>
                                                                     new TelemetrySinkParameter
                    {
                        Key   = pp.Key,
                        Value = pp.Value
                    }).ToArray()
                }).ToArray()
            };

            telemetryDataSinkMetadataRegistry.Build(telemeryDataSection);
        }
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.WindowsAzure.Management.Monitoring.Autoscale.ISettingOperations.
 /// </param>
 /// <param name='resourceId'>
 /// Required. The resource ID.
 /// </param>
 /// <returns>
 /// A standard service response including an HTTP status code and
 /// request ID.
 /// </returns>
 public static AzureOperationResponse Delete(this ISettingOperations operations, string resourceId)
 {
     return(Task.Factory.StartNew((object s) =>
     {
         return ((ISettingOperations)s).DeleteAsync(resourceId);
     }
                                  , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult());
 }
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.WindowsAzure.Management.Monitoring.Autoscale.ISettingOperations.
 /// </param>
 /// <param name='resourceId'>
 /// Required. The resource ID.
 /// </param>
 /// <param name='parameters'>
 /// Required. Parameters supplied to the operation.
 /// </param>
 /// <returns>
 /// A standard service response including an HTTP status code and
 /// request ID.
 /// </returns>
 public static OperationResponse CreateOrUpdate(this ISettingOperations operations, string resourceId, AutoscaleSettingCreateOrUpdateParameters parameters)
 {
     return(Task.Factory.StartNew((object s) =>
     {
         return ((ISettingOperations)s).CreateOrUpdateAsync(resourceId, parameters);
     }
                                  , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult());
 }
 /// <summary>
 /// Initializes a new instance of the AutoscaleClient class.
 /// </summary>
 private AutoscaleClient()
     : base()
 {
     this._settings   = new SettingOperations(this);
     this._apiVersion = "2013-10-01";
     this._longRunningOperationInitialTimeout = -1;
     this._longRunningOperationRetryTimeout   = -1;
     this.HttpClient.Timeout = TimeSpan.FromSeconds(300);
 }
Esempio n. 5
0
 private static void SafeDeleteSetting(ISettingOperations settingOperations, SettingId name)
 {
     try
     {
         settingOperations.Delete(name);
     }
     catch
     {
     }
 }
Esempio n. 6
0
 private static void SafeEnsureSetting(ISettingOperations settingOperations, SettingId name, string value)
 {
     try
     {
         settingOperations.Get(name);
     }
     catch
     {
         settingOperations.Create(new Setting(name, value));
     }
 }
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.WindowsAzure.Management.Monitoring.Autoscale.ISettingOperations.
 /// </param>
 /// <param name='resourceId'>
 /// The resource ID.
 /// </param>
 /// <returns>
 /// A standard service response including an HTTP status code and
 /// request ID.
 /// </returns>
 public static OperationResponse Delete(this ISettingOperations operations, string resourceId)
 {
     try
     {
         return(operations.DeleteAsync(resourceId).Result);
     }
     catch (AggregateException ex)
     {
         if (ex.InnerExceptions.Count > 1)
         {
             throw;
         }
         else
         {
             throw ex.InnerException;
         }
     }
 }
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.WindowsAzure.Management.Monitoring.Autoscale.ISettingOperations.
 /// </param>
 /// <param name='resourceId'>
 /// The resource ID.
 /// </param>
 /// <param name='parameters'>
 /// Parameters supplied to the operation.
 /// </param>
 /// <returns>
 /// A standard service response including an HTTP status code and
 /// request ID.
 /// </returns>
 public static OperationResponse CreateOrUpdate(this ISettingOperations operations, string resourceId, AutoscaleSettingCreateOrUpdateParameters parameters)
 {
     try
     {
         return(operations.CreateOrUpdateAsync(resourceId, parameters).Result);
     }
     catch (AggregateException ex)
     {
         if (ex.InnerExceptions.Count > 1)
         {
             throw;
         }
         else
         {
             throw ex.InnerException;
         }
     }
 }
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.WindowsAzure.Management.Monitoring.Autoscale.ISettingOperations.
 /// </param>
 /// <param name='resourceId'>
 /// The resource ID.
 /// </param>
 /// <returns>
 /// A standard service response including an HTTP status code and
 /// request ID.
 /// </returns>
 public static AutoscaleSettingGetResponse Get(this ISettingOperations operations, string resourceId)
 {
     try
     {
         return(operations.GetAsync(resourceId).Result);
     }
     catch (AggregateException ex)
     {
         if (ex.InnerExceptions.Count > 1)
         {
             throw;
         }
         else
         {
             throw ex.InnerException;
         }
     }
 }
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.WindowsAzure.Management.Monitoring.Autoscale.ISettingOperations.
 /// </param>
 /// <param name='resourceId'>
 /// The resource ID.
 /// </param>
 /// <param name='parameters'>
 /// Parameters supplied to the operation.
 /// </param>
 /// <returns>
 /// A standard service response including an HTTP status code and
 /// request ID.
 /// </returns>
 public static Task <OperationResponse> CreateOrUpdateAsync(this ISettingOperations operations, string resourceId, AutoscaleSettingCreateOrUpdateParameters parameters)
 {
     return(operations.CreateOrUpdateAsync(resourceId, parameters, CancellationToken.None));
 }
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.WindowsAzure.Management.Monitoring.Autoscale.ISettingOperations.
 /// </param>
 /// <param name='resourceId'>
 /// The resource ID.
 /// </param>
 /// <returns>
 /// A standard service response including an HTTP status code and
 /// request ID.
 /// </returns>
 public static Task <AutoscaleSettingGetResponse> GetAsync(this ISettingOperations operations, string resourceId)
 {
     return(operations.GetAsync(resourceId, CancellationToken.None));
 }
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.WindowsAzure.Management.Monitoring.Autoscale.ISettingOperations.
 /// </param>
 /// <param name='resourceId'>
 /// The resource ID.
 /// </param>
 /// <returns>
 /// A standard service response including an HTTP status code and
 /// request ID.
 /// </returns>
 public static Task <OperationResponse> DeleteAsync(this ISettingOperations operations, string resourceId)
 {
     return(operations.DeleteAsync(resourceId, CancellationToken.None));
 }
Esempio n. 13
0
 public SettingProvider(ISettingOperations settingOperations)
 {
     _settingOperations = settingOperations;
     _settings          = new ConcurrentDictionary <string, string>();
 }
 /// <summary>
 /// Initializes a new instance of the AutoscaleClient class.
 /// </summary>
 private AutoscaleClient()
     : base()
 {
     this._settings          = new SettingOperations(this);
     this.HttpClient.Timeout = TimeSpan.FromSeconds(300);
 }
Esempio n. 15
0
 public DynamicConnectionStringResolver(ISettingOperations settingOperations)
 {
     _settingOperations            = settingOperations;
     _connectionStringSettingsList = new ConcurrentDictionary <string, Setting>();
 }