Skip to content

Commit 5752caf

Browse files
committed
Standardize list references method: List<Resource>References
1 parent 9d33a8e commit 5752caf

File tree

8 files changed

+30
-30
lines changed

8 files changed

+30
-30
lines changed

src/corelib/Compute/v2_1/ComputeApiBuilder.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -167,15 +167,15 @@ protected ComputeApiBuilder(IServiceType serviceType, IAuthenticationProvider au
167167
}
168168

169169
/// <summary />
170-
public virtual async Task<TPage> ListServersAsync<TPage>(IQueryStringBuilder queryString, CancellationToken cancellationToken = default(CancellationToken))
170+
public virtual async Task<TPage> ListServerReferencesAsync<TPage>(IQueryStringBuilder queryString, CancellationToken cancellationToken = default(CancellationToken))
171171
where TPage : IPageBuilder<TPage>, IEnumerable<IServiceResource>
172172
{
173-
Url initialRequestUrl = await BuildListServersUrlAsync(queryString, cancellationToken);
174-
return await ListServersAsync<TPage>(initialRequestUrl, cancellationToken);
173+
Url initialRequestUrl = await BuildListServerReferencesUrlAsync(queryString, cancellationToken);
174+
return await ListServerReferencesAsync<TPage>(initialRequestUrl, cancellationToken);
175175
}
176176

177177
/// <summary />
178-
public virtual async Task<TPage> ListServersAsync<TPage>(Url url, CancellationToken cancellationToken)
178+
public virtual async Task<TPage> ListServerReferencesAsync<TPage>(Url url, CancellationToken cancellationToken)
179179
where TPage : IPageBuilder<TPage>, IEnumerable<IServiceResource>
180180
{
181181
var results = await url
@@ -185,14 +185,14 @@ public virtual async Task<TPage> ListServersAsync<TPage>(Url url, CancellationTo
185185
.SendAsync()
186186
.ReceiveJson<TPage>();
187187

188-
results.SetNextPageHandler(ListServersAsync<TPage>);
188+
results.SetNextPageHandler(ListServerReferencesAsync<TPage>);
189189
results.PropogateOwner(this);
190190

191191
return results;
192192
}
193193

194194
/// <summary />
195-
public virtual async Task<Url> BuildListServersUrlAsync(IQueryStringBuilder queryString, CancellationToken cancellationToken = default(CancellationToken))
195+
public virtual async Task<Url> BuildListServerReferencesUrlAsync(IQueryStringBuilder queryString, CancellationToken cancellationToken = default(CancellationToken))
196196
{
197197
Url endpoint = await UrlBuilder.GetEndpoint(cancellationToken).ConfigureAwait(false);
198198

@@ -206,7 +206,7 @@ public virtual async Task<TPage> ListServersAsync<TPage>(Url url, CancellationTo
206206
where TPage : IPageBuilder<TPage>, IEnumerable<IServiceResource>
207207
{
208208
Url initialRequestUrl = await BuildListServerDetailsUrlAsync(queryString, cancellationToken);
209-
return await ListServersAsync<TPage>(initialRequestUrl, cancellationToken);
209+
return await ListServerReferencesAsync<TPage>(initialRequestUrl, cancellationToken);
210210
}
211211

212212
/// <summary />

src/corelib/Compute/v2_1/ComputeService.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,10 @@ public ComputeService(IAuthenticationProvider authenticationProvider, string reg
5353
return _computeApi.WaitForServerStatusAsync<Server, ServerStatus>(serverId, statuses, refreshDelay, timeout, progress, cancellationToken);
5454
}
5555

56-
/// <inheritdoc cref="ComputeApiBuilder.ListServersAsync{TPage}(IQueryStringBuilder,CancellationToken)" />
57-
public async Task<IPage<ServerReference>> ListServersAsync(ServerListOptions options = null, CancellationToken cancellationToken = default(CancellationToken))
56+
/// <inheritdoc cref="ComputeApiBuilder.ListServerReferencesAsync{TPage}(IQueryStringBuilder,CancellationToken)" />
57+
public async Task<IPage<ServerReference>> ListServerReferencesAsync(ServerListOptions options = null, CancellationToken cancellationToken = default(CancellationToken))
5858
{
59-
return await _computeApi.ListServersAsync<ServerReferenceCollection>(options, cancellationToken);
59+
return await _computeApi.ListServerReferencesAsync<ServerReferenceCollection>(options, cancellationToken);
6060
}
6161

6262
/// <inheritdoc cref="ComputeApiBuilder.ListServerDetailsAsync{TPage}(IQueryStringBuilder,CancellationToken)" />

src/corelib/Compute/v2_1/ComputeServiceExtensions.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@ public static Server WaitForServerStatus(this ComputeService service, Identifier
3636
return service.WaitForServerStatusAsync(serverId, statuses, refreshDelay, timeout, progress).ForceSynchronous();
3737
}
3838

39-
/// <inheritdoc cref="ComputeService.ListServersAsync" />
40-
public static IPage<ServerReference> ListServers(this ComputeService service, ServerListOptions options = null)
39+
/// <inheritdoc cref="ComputeService.ListServerReferencesAsync" />
40+
public static IPage<ServerReference> ListServerReferences(this ComputeService service, ServerListOptions options = null)
4141
{
42-
return service.ListServersAsync(options).ForceSynchronous();
42+
return service.ListServerReferencesAsync(options).ForceSynchronous();
4343
}
4444

4545
/// <inheritdoc cref="ComputeService.ListServerDetailsAsync" />

src/corelib/Compute/v2_2/ComputeService.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ public ComputeService(IAuthenticationProvider authenticationProvider, string reg
1818
}
1919

2020
#region Servers
21-
/// <inheritdoc cref="v2_1.ComputeApiBuilder.ListServersAsync{T}(IQueryStringBuilder,CancellationToken)" />
22-
public virtual async Task<IPage<ServerReference>> ListServersAsync(ServerListOptions options = null, CancellationToken cancellationToken = default(CancellationToken))
21+
/// <inheritdoc cref="v2_1.ComputeApiBuilder.ListServerReferencesAsync{TPage}(IQueryStringBuilder,CancellationToken)" />
22+
public virtual async Task<IPage<ServerReference>> ListServerReferencesAsync(ServerListOptions options = null, CancellationToken cancellationToken = default(CancellationToken))
2323
{
24-
return await _computeApiBuilder.ListServersAsync<ServerCollection>(options, cancellationToken);
24+
return await _computeApiBuilder.ListServerReferencesAsync<ServerCollection>(options, cancellationToken);
2525
}
2626

2727
/// <summary />

src/corelib/Compute/v2_6/ComputeService.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ public ComputeService(IAuthenticationProvider authenticationProvider, string reg
2323
#region Servers
2424

2525
/// <summary />
26-
public virtual async Task<IPage<ServerReference>> ListServersAsync(ServerListOptions options = null, CancellationToken cancellationToken = default(CancellationToken))
26+
public virtual async Task<IPage<ServerReference>> ListServerReferencesAsync(ServerListOptions options = null, CancellationToken cancellationToken = default(CancellationToken))
2727
{
28-
return await _computeApiBuilder.ListServersAsync<ServerCollection>(options, cancellationToken);
28+
return await _computeApiBuilder.ListServerReferencesAsync<ServerCollection>(options, cancellationToken);
2929
}
3030

3131
/// <summary />

src/testing/integration/Compute/v2_1/ServerTests.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,9 @@ public async Task CreateServerTest()
8787
}
8888

8989
[Fact]
90-
public async Task ListServersTest()
90+
public async Task ListServerReferencesTest()
9191
{
92-
var results = await _compute.ListServersAsync(new ServerListOptions {PageSize = 1});
92+
var results = await _compute.ListServerReferencesAsync(new ServerListOptions {PageSize = 1});
9393

9494
while (results.Any())
9595
{
@@ -107,7 +107,7 @@ public async Task FindServersTest()
107107
await Task.WhenAll(servers.Select(x => x.WaitUntilActiveAsync()));
108108
var serversNames = new HashSet<string>(servers.Select(s => s.Name));
109109

110-
var results = await _compute.ListServersAsync(new ServerListOptions {Name = "ci-*"});
110+
var results = await _compute.ListServerReferencesAsync(new ServerListOptions {Name = "ci-*"});
111111
var resultNames = new HashSet<string>(results.Select(s => s.Name));
112112

113113
Assert.Subset(resultNames, serversNames);

src/testing/unit/Compute/v2_1/ServerAddressTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public void GetServerAddress()
3232
}
3333
});
3434

35-
var serverReferences = _compute.ListServers();
35+
var serverReferences = _compute.ListServerReferences();
3636
var result = (serverReferences.First().GetAddress("private")).First();
3737

3838
httpTest.ShouldHaveCalled($"*/servers/{serverId}/ips/private");
@@ -50,7 +50,7 @@ public void ListServerAddresses()
5050
httpTest.RespondWithJson(new ServerCollection { new Server { Id = serverId } });
5151
httpTest.RespondWithJson(new ServerAddressCollection {["ServiceNet"] = new List<ServerAddress> {new ServerAddress {IP = "192.168.1.189"}}});
5252

53-
var serverReferences = _compute.ListServers();
53+
var serverReferences = _compute.ListServerReferences();
5454
var results = serverReferences.First().ListAddresses();
5555

5656
httpTest.ShouldHaveCalled($"*/servers/{serverId}/ips");

src/testing/unit/Compute/v2_1/ServerTests.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public void GetServerExtension()
6666
});
6767
httpTest.RespondWithJson(new Server { Id = serverId });
6868

69-
var serverRef = _compute.ListServers().First();
69+
var serverRef = _compute.ListServerReferences().First();
7070
var result = serverRef.GetServer();
7171

7272
Assert.NotNull(result);
@@ -95,7 +95,7 @@ public void WaitForServerActive()
9595
}
9696

9797
[Fact]
98-
public void ListServers()
98+
public void ListServerReferences()
9999
{
100100
using (var httpTest = new HttpTest())
101101
{
@@ -106,7 +106,7 @@ public void ListServers()
106106
Links = { new PageLink("next", "http://api.com/next") }
107107
});
108108

109-
var results = _compute.ListServers();
109+
var results = _compute.ListServerReferences();
110110

111111
httpTest.ShouldHaveCalled("*/servers");
112112
Assert.Equal(1, results.Count());
@@ -117,7 +117,7 @@ public void ListServers()
117117
}
118118

119119
[Fact]
120-
public void ListServersWithFilter()
120+
public void ListServerReferencesWithFilter()
121121
{
122122
using (var httpTest = new HttpTest())
123123
{
@@ -129,7 +129,7 @@ public void ListServersWithFilter()
129129
var lastModified = DateTimeOffset.Now.AddDays(-1);
130130
ServerStatus status = ServerStatus.Active;
131131

132-
_compute.ListServers(new ServerListOptions { Name = name, FlavorId = flavorId, ImageId = imageId, UpdatedAfter = lastModified, Status = status});
132+
_compute.ListServerReferences(new ServerListOptions { Name = name, FlavorId = flavorId, ImageId = imageId, UpdatedAfter = lastModified, Status = status});
133133

134134
httpTest.ShouldHaveCalled($"*name={name}");
135135
httpTest.ShouldHaveCalled($"*flavor={flavorId}");
@@ -140,7 +140,7 @@ public void ListServersWithFilter()
140140
}
141141

142142
[Fact]
143-
public void ListServersWithPaging()
143+
public void ListServerReferencesWithPaging()
144144
{
145145
using (var httpTest = new HttpTest())
146146
{
@@ -152,7 +152,7 @@ public void ListServersWithPaging()
152152

153153
Identifier startingAt = Guid.NewGuid();
154154
const int pageSize = 10;
155-
_compute.ListServers(new ServerListOptions { PageSize = pageSize, StartingAt = startingAt });
155+
_compute.ListServerReferences(new ServerListOptions { PageSize = pageSize, StartingAt = startingAt });
156156

157157
httpTest.ShouldHaveCalled($"*marker={startingAt}*");
158158
httpTest.ShouldHaveCalled($"*limit={pageSize}*");

0 commit comments

Comments
 (0)