/// <summary>
 /// Lists a collection of all external Caches in the specified service
 /// instance.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='nextPageLink'>
 /// The NextLink from the previous successful call to List operation.
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <IPage <CacheContract> > ListByServiceNextAsync(this ICacheOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.ListByServiceNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
 /// <summary>
 /// Creates or updates an External Cache to be used in Api Management instance.
 /// <see href="https://docs.microsoft.com/en-us/azure/api-management/api-management-howto-cache-external" />
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='resourceGroupName'>
 /// The name of the resource group.
 /// </param>
 /// <param name='serviceName'>
 /// The name of the API Management service.
 /// </param>
 /// <param name='cacheId'>
 /// Identifier of the Cache entity. Cache identifier (should be either
 /// 'default' or valid Azure region identifier).
 /// </param>
 /// <param name='parameters'>
 /// Create or Update parameters.
 /// </param>
 /// <param name='ifMatch'>
 /// ETag of the Entity. Not required when creating an entity, but required when
 /// updating an entity.
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <CacheContract> CreateOrUpdateAsync(this ICacheOperations operations, string resourceGroupName, string serviceName, string cacheId, CacheContract parameters, string ifMatch = default(string), CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, serviceName, cacheId, parameters, ifMatch, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
 /// <summary>
 /// Lists a collection of all external Caches in the specified service
 /// instance.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='resourceGroupName'>
 /// The name of the resource group.
 /// </param>
 /// <param name='serviceName'>
 /// The name of the API Management service.
 /// </param>
 /// <param name='top'>
 /// Number of records to return.
 /// </param>
 /// <param name='skip'>
 /// Number of records to skip.
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <IPage <CacheContract> > ListByServiceAsync(this ICacheOperations operations, string resourceGroupName, string serviceName, int?top = default(int?), int?skip = default(int?), CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.ListByServiceWithHttpMessagesAsync(resourceGroupName, serviceName, top, skip, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
 /// <summary>
 /// Gets the details of the Cache specified by its identifier.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='resourceGroupName'>
 /// The name of the resource group.
 /// </param>
 /// <param name='serviceName'>
 /// The name of the API Management service.
 /// </param>
 /// <param name='cacheId'>
 /// Identifier of the Cache entity. Cache identifier (should be either
 /// 'default' or valid Azure region identifier).
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <CacheContract> GetAsync(this ICacheOperations operations, string resourceGroupName, string serviceName, string cacheId, CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, serviceName, cacheId, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
 /// <summary>
 /// Initialize a new instance of the <see cref="ScavengerTask"/> with a <see cref="CacheManager"/> name, the <see cref="CacheCapacityScavengingPolicy"/> and the <see cref="ICacheOperations"/>.
 /// </summary>
 /// <param name="numberToRemoveWhenScavenging">The number of items that should be removed from the cache when scavenging.</param>
 /// <param name="maximumElementsInCacheBeforeScavenging"></param>
 /// <param name="cacheOperations">The <see cref="ICacheOperations"/> to perform.</param>
 /// <param name="instrumentationProvider">An instrumentation provider.</param>
 public ScavengerTask(int numberToRemoveWhenScavenging,
                        int maximumElementsInCacheBeforeScavenging,
                        ICacheOperations cacheOperations,
                        ICachingInstrumentationProvider instrumentationProvider)
 {
     this.numberToRemoveWhenScavenging = numberToRemoveWhenScavenging;
     this.maximumElementsInCacheBeforeScavenging = maximumElementsInCacheBeforeScavenging;
     this.cacheOperations = cacheOperations;
     this.instrumentationProvider = instrumentationProvider;
 }
Exemple #6
0
 internal ScavengerTask(string cacheManagerName,
                        CachingConfigurationView currentConfigurationData,
                        CacheCapacityScavengingPolicy scavengingPolicy,
                        ICacheOperations cacheOperations)
 {
     this.scavengingPolicy         = scavengingPolicy;
     this.cacheManagerName         = cacheManagerName;
     this.currentConfigurationData = currentConfigurationData;
     this.cacheOperations          = cacheOperations;
 }
Exemple #7
0
 internal ScavengerTask(string cacheManagerName, 
                        CachingConfigurationView currentConfigurationData, 
                        CacheCapacityScavengingPolicy scavengingPolicy,
                        ICacheOperations cacheOperations)
 {
     this.scavengingPolicy = scavengingPolicy;
     this.cacheManagerName = cacheManagerName;
     this.currentConfigurationData = currentConfigurationData;
     this.cacheOperations = cacheOperations;
 }
Exemple #8
0
 /// <summary>
 /// Initialize a new instance of the <see cref="ScavengerTask"/> with a <see cref="CacheManager"/> name, the <see cref="CacheCapacityScavengingPolicy"/> and the <see cref="ICacheOperations"/>.
 /// </summary>
 /// <param name="numberToRemoveWhenScavenging">The number of items that should be removed from the cache when scavenging.</param>
 /// <param name="maximumElementsInCacheBeforeScavenging"></param>
 /// <param name="cacheOperations">The <see cref="ICacheOperations"/> to perform.</param>
 /// <param name="instrumentationProvider">An instrumentation provider.</param>
 public ScavengerTask(int numberToRemoveWhenScavenging,
                      int maximumElementsInCacheBeforeScavenging,
                      ICacheOperations cacheOperations,
                      ICachingInstrumentationProvider instrumentationProvider)
 {
     this.numberToRemoveWhenScavenging           = numberToRemoveWhenScavenging;
     this.maximumElementsInCacheBeforeScavenging = maximumElementsInCacheBeforeScavenging;
     this.cacheOperations         = cacheOperations;
     this.instrumentationProvider = instrumentationProvider;
 }
Exemple #9
0
        /// <summary>
        /// Initialize a new instance of the <see cref="ScavengerTask"/> with a <see cref="CacheManager"/> name, a <see cref="CachingConfigurationView"/>, the <see cref="CacheCapacityScavengingPolicy"/> and the <see cref="ICacheOperations"/>.
        /// </summary>
        /// <param name="numberToRemoveWhenScavenging">The number of items that should be removed from the cache when scavenging.</param>
        /// <param name="scavengingPolicy">The <see cref="CacheCapacityScavengingPolicy"/> to use.</param>
        /// <param name="cacheOperations">The <see cref="ICacheOperations"/> to perform.</param>
        /// <param name="instrumentationProvider">An instrumentation provider.</param>
        public ScavengerTask(int numberToRemoveWhenScavenging,
							   CacheCapacityScavengingPolicy scavengingPolicy,
							   ICacheOperations cacheOperations,
							   CachingInstrumentationProvider instrumentationProvider)
        {
            this.numberToRemoveWhenScavenging = numberToRemoveWhenScavenging;
            this.scavengingPolicy = scavengingPolicy;
            this.cacheOperations = cacheOperations;
            this.instrumentationProvider = instrumentationProvider;
        }
Exemple #10
0
 public ScavengerTask(int numberToRemoveWhenScavenging,
                      CacheCapacityScavengingPolicy scavengingPolicy,
                      ICacheOperations cacheOperations,
                      CachingInstrumentationProvider instrumentationProvider)
 {
     this.numberToRemoveWhenScavenging = numberToRemoveWhenScavenging;
     this.scavengingPolicy             = scavengingPolicy;
     this.cacheOperations         = cacheOperations;
     this.instrumentationProvider = instrumentationProvider;
 }
 public DiagnosticKeysController(ICacheOperations cacheOperations, ILogger <DiagnosticKeysController> logger,
                                 ITemporaryExposureKeyRepository temporaryExposureKeyRepository, IExposureKeyValidator exposureKeyValidator,
                                 IExposureConfigurationService exposureConfigurationService, KeyValidationConfiguration keyValidationRulesConfig,
                                 ICountryRepository countryRepository, AppSettingsConfig appSettingsConfig, IAddTemporaryExposureKeyService addTemporaryExposureKeyService)
 {
     _addTemporaryExposureKeyService = addTemporaryExposureKeyService;
     _cacheOperations = cacheOperations;
     _temporaryExposureKeyRepository = temporaryExposureKeyRepository;
     _exposureKeyValidator           = exposureKeyValidator;
     _logger = logger;
     _exposureConfigurationService = exposureConfigurationService;
     _keyValidationRulesConfig     = keyValidationRulesConfig;
     _appSettingsConfig            = appSettingsConfig;
     _countryRepository            = countryRepository;
 }
 public NullExpirationTask(ICacheOperations cacheOperations, CachingInstrumentationProvider instrumentationProvider)
     : base(cacheOperations, instrumentationProvider)
 {
 }
 public RaceConditionSimulatingExpirationTask(ICacheOperations cacheOperations,
                                              ICachingInstrumentationProvider instrumentationProvider)
     : base(cacheOperations, instrumentationProvider)
 {
 }
            protected internal override ExpirationTask CreateExpirationTask(ICacheOperations cacheOperations, CachingInstrumentationProvider instrumentationProvider)
            {
				return new RaceConditionSimulatingExpirationTask(cacheOperations, instrumentationProvider);
            }
 /// <summary>
 /// Made protected for testing purposes.
 /// </summary>
 /// <param name="cacheOperations">For testing only.</param>
 /// <param name="instrumentationProvider">For testing only.</param>
 /// <returns>For testing only.</returns>
 protected internal virtual ExpirationTask CreateExpirationTask(ICacheOperations cacheOperations, CachingInstrumentationProvider instrumentationProvider)
 {
     return new ExpirationTask(cacheOperations, instrumentationProvider);
 }
 /// <summary>
 /// Method protected for testing purposes. Do not call this method
 /// </summary>
 /// <param name="cacheOperations">For testing only.</param>
 /// <returns>For testing only.</returns>
 internal virtual ExpirationTask CreateExpirationTask(ICacheOperations cacheOperations)
 {
     return new ExpirationTask(cacheOperations);
 }
 /// <summary>
 /// Deletes specific Cache.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='resourceGroupName'>
 /// The name of the resource group.
 /// </param>
 /// <param name='serviceName'>
 /// The name of the API Management service.
 /// </param>
 /// <param name='cacheId'>
 /// Identifier of the Cache entity. Cache identifier (should be either
 /// 'default' or valid Azure region identifier).
 /// </param>
 /// <param name='ifMatch'>
 /// ETag of the Entity. ETag should match the current entity state from the
 /// header response of the GET request or it should be * for unconditional
 /// update.
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task DeleteAsync(this ICacheOperations operations, string resourceGroupName, string serviceName, string cacheId, string ifMatch, CancellationToken cancellationToken = default(CancellationToken))
 {
     (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, serviceName, cacheId, ifMatch, null, cancellationToken).ConfigureAwait(false)).Dispose();
 }
 internal override ExpirationTask CreateExpirationTask(ICacheOperations cacheOperations)
 {
     return(new RaceConditionSimulatingExpirationTask(cacheOperations));
 }
 public RaceConditionSimulatingExpirationTask(ICacheOperations cacheOperations) : base(cacheOperations)
 {
 }
Exemple #20
0
 internal ExpirationTask(ICacheOperations cacheOperations)
 {
     this.cacheOperations = cacheOperations;
 }
Exemple #21
0
 //private ICachingInstrumentationProvider instrumentationProvider;
 /// <summary>
 /// Initialize an instance of the <see cref="ExpirationTask"/> class with an <see cref="ICacheOperations"/> object.
 /// </summary>
 /// <param name="cacheOperations">An <see cref="ICacheOperations"/> object.</param>
 /// <param name="instrumentationProvider">An instrumentation provider.</param>
 public ExpirationTask(ICacheOperations cacheOperations)
 {
     this.cacheOperations = cacheOperations;
     //this.instrumentationProvider = instrumentationProvider;
 }
 /// <summary>
 /// Deletes specific Cache.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='resourceGroupName'>
 /// The name of the resource group.
 /// </param>
 /// <param name='serviceName'>
 /// The name of the API Management service.
 /// </param>
 /// <param name='cacheId'>
 /// Identifier of the Cache entity. Cache identifier (should be either
 /// 'default' or valid Azure region identifier).
 /// </param>
 /// <param name='ifMatch'>
 /// ETag of the Entity. ETag should match the current entity state from the
 /// header response of the GET request or it should be * for unconditional
 /// update.
 /// </param>
 public static void Delete(this ICacheOperations operations, string resourceGroupName, string serviceName, string cacheId, string ifMatch)
 {
     operations.DeleteAsync(resourceGroupName, serviceName, cacheId, ifMatch).GetAwaiter().GetResult();
 }
		/// <summary>
		/// Initialize an instance of the <see cref="ExpirationTask"/> class with an <see cref="ICacheOperations"/> object.
		/// </summary>
		/// <param name="cacheOperations">An <see cref="ICacheOperations"/> object.</param>
		/// <param name="instrumentationProvider">An instrumentation provider.</param>
		public ExpirationTask(ICacheOperations cacheOperations, ICachingInstrumentationProvider instrumentationProvider)
        {
            this.cacheOperations = cacheOperations;
			this.instrumentationProvider = instrumentationProvider;
        }
 /// <summary>
 /// Lists a collection of all external Caches in the specified service
 /// instance.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='nextPageLink'>
 /// The NextLink from the previous successful call to List operation.
 /// </param>
 public static IPage <CacheContract> ListByServiceNext(this ICacheOperations operations, string nextPageLink)
 {
     return(operations.ListByServiceNextAsync(nextPageLink).GetAwaiter().GetResult());
 }
 /// <summary>
 /// Made protected for testing purposes.
 /// </summary>
 /// <param name="cacheOperations">For testing only.</param>
 /// <param name="instrumentationProvider">For testing only.</param>
 /// <returns>For testing only.</returns>
 protected internal virtual ExpirationTask CreateExpirationTask(ICacheOperations cacheOperations, CachingInstrumentationProvider instrumentationProvider)
 {
     return(new ExpirationTask(cacheOperations, instrumentationProvider));
 }
 /// <summary>
 /// Lists a collection of all external Caches in the specified service
 /// instance.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='resourceGroupName'>
 /// The name of the resource group.
 /// </param>
 /// <param name='serviceName'>
 /// The name of the API Management service.
 /// </param>
 /// <param name='top'>
 /// Number of records to return.
 /// </param>
 /// <param name='skip'>
 /// Number of records to skip.
 /// </param>
 public static IPage <CacheContract> ListByService(this ICacheOperations operations, string resourceGroupName, string serviceName, int?top = default(int?), int?skip = default(int?))
 {
     return(operations.ListByServiceAsync(resourceGroupName, serviceName, top, skip).GetAwaiter().GetResult());
 }
 /// <summary>
 /// Gets the details of the Cache specified by its identifier.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='resourceGroupName'>
 /// The name of the resource group.
 /// </param>
 /// <param name='serviceName'>
 /// The name of the API Management service.
 /// </param>
 /// <param name='cacheId'>
 /// Identifier of the Cache entity. Cache identifier (should be either
 /// 'default' or valid Azure region identifier).
 /// </param>
 public static CacheContract Get(this ICacheOperations operations, string resourceGroupName, string serviceName, string cacheId)
 {
     return(operations.GetAsync(resourceGroupName, serviceName, cacheId).GetAwaiter().GetResult());
 }
 /// <summary>
 /// Gets the entity state (Etag) version of the Cache specified by its
 /// identifier.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='resourceGroupName'>
 /// The name of the resource group.
 /// </param>
 /// <param name='serviceName'>
 /// The name of the API Management service.
 /// </param>
 /// <param name='cacheId'>
 /// Identifier of the Cache entity. Cache identifier (should be either
 /// 'default' or valid Azure region identifier).
 /// </param>
 public static CacheGetEntityTagHeaders GetEntityTag(this ICacheOperations operations, string resourceGroupName, string serviceName, string cacheId)
 {
     return(operations.GetEntityTagAsync(resourceGroupName, serviceName, cacheId).GetAwaiter().GetResult());
 }
Exemple #29
0
        //private ICachingInstrumentationProvider instrumentationProvider;

        /// <summary>
        /// Initialize an instance of the <see cref="ExpirationTask"/> class with an <see cref="ICacheOperations"/> object.
        /// </summary>
        /// <param name="cacheOperations">An <see cref="ICacheOperations"/> object.</param>
        /// <param name="instrumentationProvider">An instrumentation provider.</param>
        public ExpirationTask(ICacheOperations cacheOperations)
        {
            this.cacheOperations = cacheOperations;
            //this.instrumentationProvider = instrumentationProvider;
        }
            public RaceConditionSimulatingExpirationTask(ICacheOperations cacheOperations, CachingInstrumentationProvider instrumentationProvider) 
				: base(cacheOperations, instrumentationProvider)
            {
            }
 /// <summary>
 /// Creates or updates an External Cache to be used in Api Management instance.
 /// <see href="https://docs.microsoft.com/en-us/azure/api-management/api-management-howto-cache-external" />
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='resourceGroupName'>
 /// The name of the resource group.
 /// </param>
 /// <param name='serviceName'>
 /// The name of the API Management service.
 /// </param>
 /// <param name='cacheId'>
 /// Identifier of the Cache entity. Cache identifier (should be either
 /// 'default' or valid Azure region identifier).
 /// </param>
 /// <param name='parameters'>
 /// Create or Update parameters.
 /// </param>
 /// <param name='ifMatch'>
 /// ETag of the Entity. Not required when creating an entity, but required when
 /// updating an entity.
 /// </param>
 public static CacheContract CreateOrUpdate(this ICacheOperations operations, string resourceGroupName, string serviceName, string cacheId, CacheContract parameters, string ifMatch = default(string))
 {
     return(operations.CreateOrUpdateAsync(resourceGroupName, serviceName, cacheId, parameters, ifMatch).GetAwaiter().GetResult());
 }
Exemple #32
0
 /// <summary>
 /// Initialize an instance of the <see cref="ExpirationTask"/> class with an <see cref="ICacheOperations"/> object.
 /// </summary>
 /// <param name="cacheOperations">An <see cref="ICacheOperations"/> object.</param>
 /// <param name="instrumentationProvider">An instrumentation provider.</param>
 public ExpirationTask(ICacheOperations cacheOperations, ICachingInstrumentationProvider instrumentationProvider)
 {
     this.cacheOperations         = cacheOperations;
     this.instrumentationProvider = instrumentationProvider;
 }
Exemple #33
0
 internal ExpirationTask(ICacheOperations cacheOperations)
 {
     this.cacheOperations = cacheOperations;
 }
 protected internal override ExpirationTask CreateExpirationTask(ICacheOperations cacheOperations, CachingInstrumentationProvider instrumentationProvider)
 {
     return(doExpirations
                             ? base.CreateExpirationTask(cacheOperations, instrumentationProvider)
                             : new NullExpirationTask(cacheOperations, instrumentationProvider));
 }
 /// <summary>
 /// Updates the details of the cache specified by its identifier.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='resourceGroupName'>
 /// The name of the resource group.
 /// </param>
 /// <param name='serviceName'>
 /// The name of the API Management service.
 /// </param>
 /// <param name='cacheId'>
 /// Identifier of the Cache entity. Cache identifier (should be either
 /// 'default' or valid Azure region identifier).
 /// </param>
 /// <param name='parameters'>
 /// Update parameters.
 /// </param>
 /// <param name='ifMatch'>
 /// ETag of the Entity. ETag should match the current entity state from the
 /// header response of the GET request or it should be * for unconditional
 /// update.
 /// </param>
 public static void Update(this ICacheOperations operations, string resourceGroupName, string serviceName, string cacheId, CacheUpdateParameters parameters, string ifMatch)
 {
     operations.UpdateAsync(resourceGroupName, serviceName, cacheId, parameters, ifMatch).GetAwaiter().GetResult();
 }
 /// <summary>
 /// Method protected for testing purposes. Do not call this method
 /// </summary>
 /// <param name="cacheOperations">For testing only.</param>
 /// <returns>For testing only.</returns>
 internal virtual ExpirationTask CreateExpirationTask(ICacheOperations cacheOperations)
 {
     return(new ExpirationTask(cacheOperations));
 }
 protected internal override ExpirationTask CreateExpirationTask(ICacheOperations cacheOperations, CachingInstrumentationProvider instrumentationProvider)
 {
     return(new RaceConditionSimulatingExpirationTask(cacheOperations, instrumentationProvider));
 }