Skip to content

Commit

Permalink
Rename AzureResourceDefinition subclasses
Browse files Browse the repository at this point in the history
When I was making the initial set of changes, I didn't want to make too many changes at once, so I held off on renaming the subclasses of `AzureResourceDefinition`. This change renames them all from `{Type}MetricDefinition` to `{Type}ResourceDefinition` to make it clearer what they are.
  • Loading branch information
adamconnelly committed Aug 15, 2019
1 parent fd4a234 commit b4ceab3
Show file tree
Hide file tree
Showing 41 changed files with 118 additions and 118 deletions.
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
namespace Promitor.Core.Scraping.Configuration.Model.Metrics.ResourceTypes
{
public class ContainerInstanceMetricDefinition : AzureResourceDefinition
public class ContainerInstanceResourceDefinition : AzureResourceDefinition
{
public ContainerInstanceMetricDefinition() : base(ResourceType.ContainerInstance)
public ContainerInstanceResourceDefinition() : base(ResourceType.ContainerInstance)
{
}

public ContainerInstanceMetricDefinition(string resourceGroupName, string containerGroup)
public ContainerInstanceResourceDefinition(string resourceGroupName, string containerGroup)
: base(ResourceType.ContainerInstance, resourceGroupName)
{
ContainerGroup = containerGroup;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
namespace Promitor.Core.Scraping.Configuration.Model.Metrics.ResourceTypes
{
public class ContainerRegistryMetricDefinition : AzureResourceDefinition
public class ContainerRegistryResourceDefinition : AzureResourceDefinition
{
public ContainerRegistryMetricDefinition() : base(ResourceType.ContainerRegistry)
public ContainerRegistryResourceDefinition() : base(ResourceType.ContainerRegistry)
{
}

public ContainerRegistryMetricDefinition(string resourceGroupName, string registryName)
public ContainerRegistryResourceDefinition(string resourceGroupName, string registryName)
: base(ResourceType.ContainerRegistry, resourceGroupName)
{
RegistryName = registryName;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
namespace Promitor.Core.Scraping.Configuration.Model.Metrics.ResourceTypes
{
public class CosmosDbMetricDefinition : AzureResourceDefinition
public class CosmosDbResourceDefinition : AzureResourceDefinition
{
public CosmosDbMetricDefinition() : base(ResourceType.CosmosDb)
public CosmosDbResourceDefinition() : base(ResourceType.CosmosDb)
{
}

public CosmosDbMetricDefinition(string resourceGroupName, string dbName)
public CosmosDbResourceDefinition(string resourceGroupName, string dbName)
: base(ResourceType.CosmosDb, resourceGroupName)
{
DbName = dbName;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
namespace Promitor.Core.Scraping.Configuration.Model.Metrics.ResourceTypes
{
public class GenericAzureMetricDefinition : AzureResourceDefinition
public class GenericAzureResourceDefinition : AzureResourceDefinition
{
public GenericAzureMetricDefinition() : base(ResourceType.Generic)
public GenericAzureResourceDefinition() : base(ResourceType.Generic)
{
}

public GenericAzureMetricDefinition(string resourceGroupName, string filter, string resourceUri)
public GenericAzureResourceDefinition(string resourceGroupName, string filter, string resourceUri)
: base(ResourceType.Generic, resourceGroupName)
{
Filter = filter;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
namespace Promitor.Core.Scraping.Configuration.Model.Metrics.ResourceTypes
{
public class NetworkInterfaceMetricDefinition : AzureResourceDefinition
public class NetworkInterfaceResourceDefinition : AzureResourceDefinition
{
public NetworkInterfaceMetricDefinition() : base(ResourceType.NetworkInterface)
public NetworkInterfaceResourceDefinition() : base(ResourceType.NetworkInterface)
{
}

public NetworkInterfaceMetricDefinition(string resourceGroupName, string networkInterfaceName)
public NetworkInterfaceResourceDefinition(string resourceGroupName, string networkInterfaceName)
: base(ResourceType.NetworkInterface, resourceGroupName)
{
NetworkInterfaceName = networkInterfaceName;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
namespace Promitor.Core.Scraping.Configuration.Model.Metrics.ResourceTypes
{
public class PostgreSqlMetricDefinition : AzureResourceDefinition
{
public PostgreSqlMetricDefinition() : base(ResourceType.PostgreSql)
{
}

public PostgreSqlMetricDefinition(string resourceGroupName, string serverName)
: base(ResourceType.PostgreSql, resourceGroupName)
{
ServerName = serverName;
}

public string ServerName { get; set; }
}
}
namespace Promitor.Core.Scraping.Configuration.Model.Metrics.ResourceTypes
{
public class PostgreSqlResourceDefinition : AzureResourceDefinition
{
public PostgreSqlResourceDefinition() : base(ResourceType.PostgreSql)
{
}

public PostgreSqlResourceDefinition(string resourceGroupName, string serverName)
: base(ResourceType.PostgreSql, resourceGroupName)
{
ServerName = serverName;
}

public string ServerName { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
namespace Promitor.Core.Scraping.Configuration.Model.Metrics.ResourceTypes
{
public class RedisCacheMetricDefinition : AzureResourceDefinition
{
public RedisCacheMetricDefinition() : base(ResourceType.RedisCache)
{
}

public RedisCacheMetricDefinition(string resourceGroupName, string cacheName)
: base(ResourceType.RedisCache, resourceGroupName)
{
CacheName = cacheName;
}

public string CacheName { get; set; }
}
}
namespace Promitor.Core.Scraping.Configuration.Model.Metrics.ResourceTypes
{
public class RedisCacheResourceDefinition : AzureResourceDefinition
{
public RedisCacheResourceDefinition() : base(ResourceType.RedisCache)
{
}

public RedisCacheResourceDefinition(string resourceGroupName, string cacheName)
: base(ResourceType.RedisCache, resourceGroupName)
{
CacheName = cacheName;
}

public string CacheName { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
namespace Promitor.Core.Scraping.Configuration.Model.Metrics.ResourceTypes
{
public class ServiceBusQueueMetricDefinition : AzureResourceDefinition
public class ServiceBusQueueResourceDefinition : AzureResourceDefinition
{
public ServiceBusQueueMetricDefinition() : base(ResourceType.ServiceBusQueue)
public ServiceBusQueueResourceDefinition() : base(ResourceType.ServiceBusQueue)
{
}

public ServiceBusQueueMetricDefinition(string resourceGroupName, string ns, string queueName)
public ServiceBusQueueResourceDefinition(string resourceGroupName, string ns, string queueName)
: base(ResourceType.ServiceBusQueue, resourceGroupName)
{
Namespace = ns;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
namespace Promitor.Core.Scraping.Configuration.Model.Metrics.ResourceTypes
{
public class StorageQueueMetricDefinition : AzureResourceDefinition
public class StorageQueueResourceDefinition : AzureResourceDefinition
{
public StorageQueueMetricDefinition() : base(ResourceType.StorageQueue)
public StorageQueueResourceDefinition() : base(ResourceType.StorageQueue)
{
}

public StorageQueueMetricDefinition(string resourceGroupName, string accountName, string queueName, Secret sasToken)
public StorageQueueResourceDefinition(string resourceGroupName, string accountName, string queueName, Secret sasToken)
: base(ResourceType.StorageQueue, resourceGroupName)
{
AccountName = accountName;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
namespace Promitor.Core.Scraping.Configuration.Model.Metrics.ResourceTypes
{
public class VirtualMachineMetricDefinition : AzureResourceDefinition
public class VirtualMachineResourceDefinition : AzureResourceDefinition
{
public VirtualMachineMetricDefinition() : base(ResourceType.VirtualMachine)
public VirtualMachineResourceDefinition() : base(ResourceType.VirtualMachine)
{
}

public VirtualMachineMetricDefinition(string resourceGroupName, string virtualMachineName)
public VirtualMachineResourceDefinition(string resourceGroupName, string virtualMachineName)
: base(ResourceType.VirtualMachine, resourceGroupName)
{
VirtualMachineName = virtualMachineName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,16 @@ public V1MappingProfile()
CreateMap<MetricAggregationV1, MetricAggregation>();
CreateMap<SecretV1, Secret>();

CreateMap<ContainerInstanceMetricDefinitionV1, ContainerInstanceMetricDefinition>();
CreateMap<ContainerRegistryMetricDefinitionV1, ContainerRegistryMetricDefinition>();
CreateMap<CosmosDbMetricDefinitionV1, CosmosDbMetricDefinition>();
CreateMap<GenericAzureMetricDefinitionV1, GenericAzureMetricDefinition>();
CreateMap<NetworkInterfaceMetricDefinitionV1, NetworkInterfaceMetricDefinition>();
CreateMap<PostgreSqlMetricDefinitionV1, PostgreSqlMetricDefinition>();
CreateMap<RedisCacheMetricDefinitionV1, RedisCacheMetricDefinition>();
CreateMap<ServiceBusQueueMetricDefinitionV1, ServiceBusQueueMetricDefinition>();
CreateMap<StorageQueueMetricDefinitionV1, StorageQueueMetricDefinition>();
CreateMap<VirtualMachineMetricDefinitionV1, VirtualMachineMetricDefinition>();
CreateMap<ContainerInstanceMetricDefinitionV1, ContainerInstanceResourceDefinition>();
CreateMap<ContainerRegistryMetricDefinitionV1, ContainerRegistryResourceDefinition>();
CreateMap<CosmosDbMetricDefinitionV1, CosmosDbResourceDefinition>();
CreateMap<GenericAzureMetricDefinitionV1, GenericAzureResourceDefinition>();
CreateMap<NetworkInterfaceMetricDefinitionV1, NetworkInterfaceResourceDefinition>();
CreateMap<PostgreSqlMetricDefinitionV1, PostgreSqlResourceDefinition>();
CreateMap<RedisCacheMetricDefinitionV1, RedisCacheResourceDefinition>();
CreateMap<ServiceBusQueueMetricDefinitionV1, ServiceBusQueueResourceDefinition>();
CreateMap<StorageQueueMetricDefinitionV1, StorageQueueResourceDefinition>();
CreateMap<VirtualMachineMetricDefinitionV1, VirtualMachineResourceDefinition>();

CreateMap<MetricDefinitionV1, PrometheusMetricDefinition>();

Expand All @@ -42,16 +42,16 @@ public V1MappingProfile()
.ForMember(m => m.Resources, o => o.MapFrom(v1 => new List<MetricDefinitionV1> {v1}));

CreateMap<MetricDefinitionV1, AzureResourceDefinition>()
.Include<ContainerInstanceMetricDefinitionV1, ContainerInstanceMetricDefinition>()
.Include<ContainerRegistryMetricDefinitionV1, ContainerRegistryMetricDefinition>()
.Include<CosmosDbMetricDefinitionV1, CosmosDbMetricDefinition>()
.Include<GenericAzureMetricDefinitionV1, GenericAzureMetricDefinition>()
.Include<NetworkInterfaceMetricDefinitionV1, NetworkInterfaceMetricDefinition>()
.Include<PostgreSqlMetricDefinitionV1, PostgreSqlMetricDefinition>()
.Include<RedisCacheMetricDefinitionV1, RedisCacheMetricDefinition>()
.Include<ServiceBusQueueMetricDefinitionV1, ServiceBusQueueMetricDefinition>()
.Include<StorageQueueMetricDefinitionV1, StorageQueueMetricDefinition>()
.Include<VirtualMachineMetricDefinitionV1, VirtualMachineMetricDefinition>();
.Include<ContainerInstanceMetricDefinitionV1, ContainerInstanceResourceDefinition>()
.Include<ContainerRegistryMetricDefinitionV1, ContainerRegistryResourceDefinition>()
.Include<CosmosDbMetricDefinitionV1, CosmosDbResourceDefinition>()
.Include<GenericAzureMetricDefinitionV1, GenericAzureResourceDefinition>()
.Include<NetworkInterfaceMetricDefinitionV1, NetworkInterfaceResourceDefinition>()
.Include<PostgreSqlMetricDefinitionV1, PostgreSqlResourceDefinition>()
.Include<RedisCacheMetricDefinitionV1, RedisCacheResourceDefinition>()
.Include<ServiceBusQueueMetricDefinitionV1, ServiceBusQueueResourceDefinition>()
.Include<StorageQueueMetricDefinitionV1, StorageQueueResourceDefinition>()
.Include<VirtualMachineMetricDefinitionV1, VirtualMachineResourceDefinition>();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

namespace Promitor.Core.Scraping.ResourceTypes
{
public class ContainerInstanceScraper : Scraper<ContainerInstanceMetricDefinition>
public class ContainerInstanceScraper : Scraper<ContainerInstanceResourceDefinition>
{
private const string ResourceUriTemplate = "subscriptions/{0}/resourceGroups/{1}/providers/Microsoft.ContainerInstance/containerGroups/{2}";

Expand All @@ -15,7 +15,7 @@ public ContainerInstanceScraper(ScraperConfiguration scraperConfiguration)
{
}

protected override async Task<ScrapeResult> ScrapeResourceAsync(string subscriptionId, string resourceGroupName, ScrapeDefinition<AzureResourceDefinition> scrapeDefinition, ContainerInstanceMetricDefinition resource, AggregationType aggregationType, TimeSpan aggregationInterval)
protected override async Task<ScrapeResult> ScrapeResourceAsync(string subscriptionId, string resourceGroupName, ScrapeDefinition<AzureResourceDefinition> scrapeDefinition, ContainerInstanceResourceDefinition resource, AggregationType aggregationType, TimeSpan aggregationInterval)
{
var resourceUri = string.Format(ResourceUriTemplate, AzureMetadata.SubscriptionId, resourceGroupName, resource.ContainerGroup);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

namespace Promitor.Core.Scraping.ResourceTypes
{
public class ContainerRegistryScraper : Scraper<ContainerRegistryMetricDefinition>
public class ContainerRegistryScraper : Scraper<ContainerRegistryResourceDefinition>
{
private const string ResourceUriTemplate = "subscriptions/{0}/resourceGroups/{1}/providers/Microsoft.ContainerRegistry/registries/{2}";

Expand All @@ -15,7 +15,7 @@ public ContainerRegistryScraper(ScraperConfiguration scraperConfiguration)
{
}

protected override async Task<ScrapeResult> ScrapeResourceAsync(string subscriptionId, string resourceGroupName, ScrapeDefinition<AzureResourceDefinition> scrapeDefinition, ContainerRegistryMetricDefinition resource, AggregationType aggregationType, TimeSpan aggregationInterval)
protected override async Task<ScrapeResult> ScrapeResourceAsync(string subscriptionId, string resourceGroupName, ScrapeDefinition<AzureResourceDefinition> scrapeDefinition, ContainerRegistryResourceDefinition resource, AggregationType aggregationType, TimeSpan aggregationInterval)
{
var resourceUri = string.Format(ResourceUriTemplate, subscriptionId, resourceGroupName, resource.RegistryName);

Expand Down
4 changes: 2 additions & 2 deletions src/Promitor.Core.Scraping/ResourceTypes/CosmosDbScraper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

namespace Promitor.Core.Scraping.ResourceTypes
{
public class CosmosDbScraper : Scraper<CosmosDbMetricDefinition>
public class CosmosDbScraper : Scraper<CosmosDbResourceDefinition>
{
private const string ResourceUriTemplate = "subscriptions/{0}/resourceGroups/{1}/providers/Microsoft.DocumentDB/databaseAccounts/{2}";

Expand All @@ -15,7 +15,7 @@ public CosmosDbScraper(ScraperConfiguration scraperConfiguration)
{
}

protected override async Task<ScrapeResult> ScrapeResourceAsync(string subscriptionId, string resourceGroupName, ScrapeDefinition<AzureResourceDefinition> scrapeDefinition, CosmosDbMetricDefinition resource, AggregationType aggregationType, TimeSpan aggregationInterval)
protected override async Task<ScrapeResult> ScrapeResourceAsync(string subscriptionId, string resourceGroupName, ScrapeDefinition<AzureResourceDefinition> scrapeDefinition, CosmosDbResourceDefinition resource, AggregationType aggregationType, TimeSpan aggregationInterval)
{
var resourceUri = string.Format(ResourceUriTemplate, subscriptionId, resourceGroupName, resource.DbName);

Expand Down
4 changes: 2 additions & 2 deletions src/Promitor.Core.Scraping/ResourceTypes/GenericScraper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

namespace Promitor.Core.Scraping.ResourceTypes
{
internal class GenericScraper : Scraper<GenericAzureMetricDefinition>
internal class GenericScraper : Scraper<GenericAzureResourceDefinition>
{
private const string ResourceUriTemplate = "subscriptions/{0}/resourceGroups/{1}/providers/{2}";

Expand All @@ -15,7 +15,7 @@ public GenericScraper(ScraperConfiguration scraperConfiguration)
{
}

protected override async Task<ScrapeResult> ScrapeResourceAsync(string subscriptionId, string resourceGroupName, ScrapeDefinition<AzureResourceDefinition> scrapeDefinition, GenericAzureMetricDefinition resource, AggregationType aggregationType, TimeSpan aggregationInterval)
protected override async Task<ScrapeResult> ScrapeResourceAsync(string subscriptionId, string resourceGroupName, ScrapeDefinition<AzureResourceDefinition> scrapeDefinition, GenericAzureResourceDefinition resource, AggregationType aggregationType, TimeSpan aggregationInterval)
{
var resourceUri = string.Format(ResourceUriTemplate, subscriptionId, resourceGroupName, resource.ResourceUri);
var metricName = scrapeDefinition.AzureMetricConfiguration.MetricName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

namespace Promitor.Core.Scraping.ResourceTypes
{
internal class NetworkInterfaceScraper : Scraper<NetworkInterfaceMetricDefinition>
internal class NetworkInterfaceScraper : Scraper<NetworkInterfaceResourceDefinition>
{
private const string ResourceUriTemplate = "subscriptions/{0}/resourceGroups/{1}/providers/Microsoft.Network/networkInterfaces/{2}";

Expand All @@ -15,7 +15,7 @@ public NetworkInterfaceScraper(ScraperConfiguration scraperConfiguration)
{
}

protected override async Task<ScrapeResult> ScrapeResourceAsync(string subscriptionId, string resourceGroupName, ScrapeDefinition<AzureResourceDefinition> scrapeDefinition, NetworkInterfaceMetricDefinition resource, AggregationType aggregationType, TimeSpan aggregationInterval)
protected override async Task<ScrapeResult> ScrapeResourceAsync(string subscriptionId, string resourceGroupName, ScrapeDefinition<AzureResourceDefinition> scrapeDefinition, NetworkInterfaceResourceDefinition resource, AggregationType aggregationType, TimeSpan aggregationInterval)
{
var resourceUri = string.Format(ResourceUriTemplate, AzureMetadata.SubscriptionId, resourceGroupName, resource.NetworkInterfaceName);

Expand Down
4 changes: 2 additions & 2 deletions src/Promitor.Core.Scraping/ResourceTypes/PostgreSqlScraper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

namespace Promitor.Core.Scraping.ResourceTypes
{
public class PostgreSqlScraper : Scraper<PostgreSqlMetricDefinition>
public class PostgreSqlScraper : Scraper<PostgreSqlResourceDefinition>
{
private const string ResourceUriTemplate = "subscriptions/{0}/resourceGroups/{1}/providers/Microsoft.DBforPostgreSQL/servers/{2}";

Expand All @@ -15,7 +15,7 @@ public PostgreSqlScraper(ScraperConfiguration scraperConfiguration)
{
}

protected override async Task<ScrapeResult> ScrapeResourceAsync(string subscriptionId, string resourceGroupName, ScrapeDefinition<AzureResourceDefinition> scrapeDefinition, PostgreSqlMetricDefinition resource, AggregationType aggregationType, TimeSpan aggregationInterval)
protected override async Task<ScrapeResult> ScrapeResourceAsync(string subscriptionId, string resourceGroupName, ScrapeDefinition<AzureResourceDefinition> scrapeDefinition, PostgreSqlResourceDefinition resource, AggregationType aggregationType, TimeSpan aggregationInterval)
{
var resourceUri = string.Format(ResourceUriTemplate, subscriptionId, resourceGroupName, resource.ServerName);

Expand Down
Loading

0 comments on commit b4ceab3

Please sign in to comment.