Exemplo n.º 1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="BlockStore"/> class.
 /// </summary>
 public BlockStore(IOptions <NakoConfiguration> configuration, ILogger <BlockStore> logger, IStorageOperations storageOperations, SyncConnection syncConnection)
     : base(configuration, logger)
 {
     this.storageOperations = storageOperations;
     this.syncConnection    = syncConnection;
     this.log = logger;
 }
 /// <summary>
 /// Gets a URL with SAS token for a container/blob in the storage account
 /// associated with the workspace. The SAS URL can be used to upload job input
 /// and/or download job output.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='blobDetails'>
 /// The details (name and container) of the blob to store or download data.
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <SasUriResponse> SasUriAsync(this IStorageOperations operations, BlobDetails blobDetails, CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.SasUriWithHttpMessagesAsync(blobDetails, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="StatsHandler"/> class.
 /// </summary>
 public CommandHandler(SyncConnection connection, ILogger <CommandHandler> logger, IStorageOperations storageOperations, ICryptoClientFactory clientFactory)
 {
     log = logger;
     this.storageOperations = storageOperations;
     this.clientFactory     = clientFactory;
     syncConnection         = connection;
 }
Exemplo n.º 4
0
 /// <summary>
 /// Get the list of all storages for the subscription
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.WindowsAzure.Management.SiteRecovery.IStorageOperations.
 /// </param>
 /// <param name='subscriptionId'>
 /// Optional.
 /// </param>
 /// <returns>
 /// The List Storage Accounts operation response.
 /// </returns>
 public static StorageAccountListResponse ListAzureStorages(this IStorageOperations operations, string subscriptionId)
 {
     return(Task.Factory.StartNew((object s) =>
     {
         return ((IStorageOperations)s).ListAzureStoragesAsync(subscriptionId);
     }
                                  , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult());
 }
Exemplo n.º 5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="BlockStore"/> class.
 /// </summary>
 public BlockStore(IOptions <IndexerSettings> configuration, ILogger <BlockStore> logger, IStorageOperations storageOperations, SyncConnection syncConnection)
     : base(configuration, logger)
 {
     this.storageOperations = storageOperations;
     this.syncConnection    = syncConnection;
     log   = logger;
     watch = Stopwatch.Start();
 }
Exemplo n.º 6
0
 /// <summary>
 /// Get the list of all storages under the vault.
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.WindowsAzure.Management.SiteRecovery.IStorageOperations.
 /// </param>
 /// <param name='serverId'>
 /// Required. Server Id.
 /// </param>
 /// <param name='customRequestHeaders'>
 /// Optional. Request header parameters.
 /// </param>
 /// <returns>
 /// The response model for the list storage operation.
 /// </returns>
 public static StorageListResponse List(this IStorageOperations operations, string serverId, CustomRequestHeaders customRequestHeaders)
 {
     return(Task.Factory.StartNew((object s) =>
     {
         return ((IStorageOperations)s).ListAsync(serverId, customRequestHeaders);
     }
                                  , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult());
 }
Exemplo n.º 7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MempoolPuller"/> class.
 /// </summary>
 public MempoolPuller(
     IOptions <IndexerSettings> configuration,
     ISyncOperations syncOperations,
     SyncConnection syncConnection,
     ILogger <MempoolPuller> logger,
     IStorageOperations storageOperations)
     : base(configuration, logger)
 {
     log = logger;
     this.storageOperations = storageOperations;
     this.syncConnection    = syncConnection;
     this.syncOperations    = syncOperations;
     config = configuration.Value;
     watch  = Stopwatch.Start();
 }
Exemplo n.º 8
0
        /// <summary>
        /// Initializes a new instance of the <see cref="BlockStartup"/> class.
        /// </summary>
        public BlockStartup(
            ILogger <BlockStartup> logger,
            ISyncOperations syncOperations,
            SyncConnection syncConnection,
            IStorageOperations storageOperations,
            ICryptoClientFactory clientFactory,
            IStorage data)
            : base(logger)
        {
            connection             = syncConnection;
            this.storageOperations = storageOperations;
            this.clientFactory     = clientFactory;
            this.data           = data;
            this.syncOperations = syncOperations;
            log = logger;

            mongoData = (MongoData)data;
        }
Exemplo n.º 9
0
        /// <summary>
        ///
        /// </summary>
        public StatsSyncer(
            IOptions <IndexerSettings> configuration,
            ISyncOperations syncOperations,
            IStorageOperations storageOperations,
            IStorage storage,
            SyncConnection syncConnection,
            StatsHandler statsHandler,
            ILogger <StatsSyncer> logger) : base(configuration, logger)
        {
            log = logger;

            data = (MongoData)storage;
            this.statsHandler      = statsHandler;
            this.storageOperations = storageOperations;

            // Only run the StatsSyncer every 5 minute.
            Delay = TimeSpan.FromMinutes(5);
            watch = Stopwatch.Start();
        }
Exemplo n.º 10
0
 /// <summary>
 /// Initializes client properties.
 /// </summary>
 private void Initialize()
 {
     Jobs           = new JobsOperations(this);
     Providers      = new ProvidersOperations(this);
     Storage        = new StorageOperations(this);
     BaseUri        = new System.Uri("https://app-jobscheduler-prod.azurewebsites.net");
     AcceptLanguage = "en-US";
     LongRunningOperationRetryTimeout = 30;
     GenerateClientRequestId          = true;
     SerializationSettings            = new JsonSerializerSettings
     {
         Formatting            = Newtonsoft.Json.Formatting.Indented,
         DateFormatHandling    = Newtonsoft.Json.DateFormatHandling.IsoDateFormat,
         DateTimeZoneHandling  = Newtonsoft.Json.DateTimeZoneHandling.Utc,
         NullValueHandling     = Newtonsoft.Json.NullValueHandling.Ignore,
         ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize,
         ContractResolver      = new ReadOnlyJsonContractResolver(),
         Converters            = new List <JsonConverter>
         {
             new Iso8601TimeSpanConverter()
         }
     };
     SerializationSettings.Converters.Add(new TransformationJsonConverter());
     DeserializationSettings = new JsonSerializerSettings
     {
         DateFormatHandling    = Newtonsoft.Json.DateFormatHandling.IsoDateFormat,
         DateTimeZoneHandling  = Newtonsoft.Json.DateTimeZoneHandling.Utc,
         NullValueHandling     = Newtonsoft.Json.NullValueHandling.Ignore,
         ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize,
         ContractResolver      = new ReadOnlyJsonContractResolver(),
         Converters            = new List <JsonConverter>
         {
             new Iso8601TimeSpanConverter()
         }
     };
     CustomInitialize();
     DeserializationSettings.Converters.Add(new TransformationJsonConverter());
     DeserializationSettings.Converters.Add(new CloudErrorJsonConverter());
 }
Exemplo n.º 11
0
 /// <summary>
 /// Initializes a new instance of the SiteRecoveryManagementClient
 /// class.
 /// </summary>
 /// <param name='httpClient'>
 /// The Http client
 /// </param>
 public SiteRecoveryManagementClient(HttpClient httpClient)
     : base(httpClient)
 {
     this._jobs                = new JobOperations(this);
     this._networkMappings     = new NetworkMappingOperations(this);
     this._networks            = new NetworkOperations(this);
     this._protectionContainer = new ProtectionContainerOperations(this);
     this._protectionEntity    = new ProtectionEntityOperations(this);
     this._protectionProfile   = new ProtectionProfileOperations(this);
     this._recoveryPlan        = new RecoveryPlanOperations(this);
     this._servers             = new ServerOperations(this);
     this._sites               = new SiteOperations(this);
     this._storageMappings     = new StorageMappingOperations(this);
     this._storages            = new StorageOperations(this);
     this._vaultExtendedInfo   = new VaultExtendedInfoOperations(this);
     this._vmGroup             = new VirtualMachineGroupOperations(this);
     this._vm         = new VirtualMachineOperations(this);
     this._apiVersion = "2013-03-01";
     this._longRunningOperationInitialTimeout = -1;
     this._longRunningOperationRetryTimeout   = -1;
     this.HttpClient.Timeout = TimeSpan.FromSeconds(300);
 }
Exemplo n.º 12
0
 public DeleteModel(ApplicationContext context, IHostingEnvironment appEnvironment, IOptions <Constants> config, IStorageOperations storage)
 {
     _context        = context;
     _appEnvironment = appEnvironment;
     _config         = config;
     _processor      = new ImageProcessor(storage);
 }
 /// <summary>
 /// Gets a URL with SAS token for a container/blob in the storage account
 /// associated with the workspace. The SAS URL can be used to upload job input
 /// and/or download job output.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='blobDetails'>
 /// The details (name and container) of the blob to store or download data.
 /// </param>
 public static SasUriResponse SasUri(this IStorageOperations operations, BlobDetails blobDetails)
 {
     return(operations.SasUriAsync(blobDetails).GetAwaiter().GetResult());
 }
Exemplo n.º 14
0
 public CreateModel(ApplicationContext context, IHostingEnvironment appEnvironment, IStorageOperations storage)
 {
     _context        = context;
     _appEnvironment = appEnvironment;
     _processor      = new ImageProcessor(storage);
 }
Exemplo n.º 15
0
 /// <summary>
 /// Get the list of all storages under the vault.
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.WindowsAzure.Management.SiteRecovery.IStorageOperations.
 /// </param>
 /// <param name='serverId'>
 /// Required. Server Id.
 /// </param>
 /// <param name='customRequestHeaders'>
 /// Optional. Request header parameters.
 /// </param>
 /// <returns>
 /// The response model for the list storage operation.
 /// </returns>
 public static Task <StorageListResponse> ListAsync(this IStorageOperations operations, string serverId, CustomRequestHeaders customRequestHeaders)
 {
     return(operations.ListAsync(serverId, customRequestHeaders, CancellationToken.None));
 }
Exemplo n.º 16
0
 public DeleteModel(ApplicationContext context, IOptions <Constants> config, IStorageOperations storage)
 {
     _context   = context;
     _config    = config;
     _processor = new ImageProcessor(storage);
 }
Exemplo n.º 17
0
 public HulaStatusController(IHulaStatusRepository hulaStatusRepository, IStorageOperations storageOperations)
 {
     HulaStatusRepository = hulaStatusRepository;
     StorageOperations    = storageOperations;
 }
Exemplo n.º 18
0
 /// <summary>
 /// Initializes a new instance of the <see cref="BlockStore"/> class.
 /// </summary>
 public BlockStore(NakoApplication application, NakoConfiguration config, Tracer tracer, IStorageOperations storageOperations)
     : base(application, config, tracer)
 {
     this.storageOperations = storageOperations;
     this.tracer            = tracer;
 }
Exemplo n.º 19
0
 /// <summary>
 /// Get the list of all storages for the subscription
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.WindowsAzure.Management.SiteRecovery.IStorageOperations.
 /// </param>
 /// <param name='subscriptionId'>
 /// Optional.
 /// </param>
 /// <returns>
 /// The List Storage Accounts operation response.
 /// </returns>
 public static Task <StorageAccountListResponse> ListAzureStoragesAsync(this IStorageOperations operations, string subscriptionId)
 {
     return(operations.ListAzureStoragesAsync(subscriptionId, CancellationToken.None));
 }
Exemplo n.º 20
0
 public ImageProcessor(IStorageOperations storage)
 {
     _storage = storage;
 }