Skip to content

Commit

Permalink
fix(clients): correly parse usage hosts (generated)
Browse files Browse the repository at this point in the history
algolia/api-clients-automation#3622

Co-authored-by: algolia-bot <accounts+algolia-api-client-bot@algolia.com>
Co-authored-by: Clément Vannicatte <vannicattec@gmail.com>
  • Loading branch information
algolia-bot and shortcuts committed Aug 30, 2024
1 parent e81b33e commit fd2f63c
Show file tree
Hide file tree
Showing 10 changed files with 9 additions and 44 deletions.
1 change: 0 additions & 1 deletion algoliasearch/Clients/AbtestingConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,3 @@ private static List<StatefulHost> GetDefaultHosts(string region)
return hosts;
}
}

1 change: 0 additions & 1 deletion algoliasearch/Clients/AnalyticsConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,3 @@ private static List<StatefulHost> GetDefaultHosts(string region)
return hosts;
}
}

1 change: 0 additions & 1 deletion algoliasearch/Clients/IngestionConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,3 @@ private static List<StatefulHost> GetDefaultHosts(string region)
return hosts;
}
}

1 change: 0 additions & 1 deletion algoliasearch/Clients/InsightsConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,3 @@ private static List<StatefulHost> GetDefaultHosts(string region)
return hosts;
}
}

3 changes: 1 addition & 2 deletions algoliasearch/Clients/MonitoringConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@ private static List<StatefulHost> GetDefaultHosts()
Up = true,
LastUse = DateTime.UtcNow,
Accept = CallType.Read | CallType.Write
}
},
};
}
}

1 change: 0 additions & 1 deletion algoliasearch/Clients/PersonalizationConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,3 @@ private static List<StatefulHost> GetDefaultHosts(string region)
return hosts;
}
}

1 change: 0 additions & 1 deletion algoliasearch/Clients/QuerySuggestionsConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,3 @@ private static List<StatefulHost> GetDefaultHosts(string region)
return hosts;
}
}

1 change: 0 additions & 1 deletion algoliasearch/Clients/RecommendConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,3 @@ private static List<StatefulHost> GetDefaultHosts(string appId)
return hosts;
}
}

1 change: 0 additions & 1 deletion algoliasearch/Clients/SearchConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,3 @@ private static List<StatefulHost> GetDefaultHosts(string appId)
return hosts;
}
}

42 changes: 8 additions & 34 deletions algoliasearch/Clients/UsageConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,53 +29,27 @@ public sealed class UsageConfig : AlgoliaConfig
/// <param name="apiKey">Your API Key</param>
public UsageConfig(string appId, string apiKey) : base(appId, apiKey, "Usage")
{
DefaultHosts = GetDefaultHosts(appId);
DefaultHosts = GetDefaultHosts();
Compression = CompressionType.None;
}
private static List<StatefulHost> GetDefaultHosts(string appId)
private static List<StatefulHost> GetDefaultHosts()
{
var hosts = new List<StatefulHost>
return new List<StatefulHost>
{
new()
{
Url = $"{appId}-dsn.algolia.net",
Url = "usage.algolia.com",
Up = true,
LastUse = DateTime.UtcNow,
Accept = CallType.Read
Accept = CallType.Read | CallType.Write
},
new()
{
Url = $"{appId}.algolia.net", Up = true, LastUse = DateTime.UtcNow, Accept = CallType.Write,
}
};

var commonHosts = new List<StatefulHost>
{
new()
{
Url = $"{appId}-1.algolianet.com",
Url = "usage-dev.algolia.com",
Up = true,
LastUse = DateTime.UtcNow,
Accept = CallType.Read | CallType.Write,
Accept = CallType.Read | CallType.Write
},
new()
{
Url = $"{appId}-2.algolianet.com",
Up = true,
LastUse = DateTime.UtcNow,
Accept = CallType.Read | CallType.Write,
},
new()
{
Url = $"{appId}-3.algolianet.com",
Up = true,
LastUse = DateTime.UtcNow,
Accept = CallType.Read | CallType.Write,
}
}.Shuffle();

hosts.AddRange(commonHosts);
return hosts;
};
}
}

0 comments on commit fd2f63c

Please sign in to comment.