Skip to content

Commit e033550

Browse files
committed
Rename ServiceUrlBuilder to ServiceEndpoint
1 parent 5de00b4 commit e033550

6 files changed

Lines changed: 130 additions & 128 deletions

File tree

src/corelib/Compute/v2_1/ComputeApiBuilder.cs

Lines changed: 91 additions & 89 deletions
Large diffs are not rendered by default.

src/corelib/Compute/v2_6/ComputeApiBuilder.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ protected ComputeApiBuilder(IServiceType serviceType, IAuthenticationProvider au
4545
{
4646
var body = new { remote_console = new { protocol, type } };
4747

48-
PreparedRequest request = await UrlBuilder.PrepareRequest($"servers/{serverId}/remote-consoles", cancellationToken);
48+
PreparedRequest request = await Endpoint.PrepareRequest($"servers/{serverId}/remote-consoles", cancellationToken);
4949
return request.PreparePostJson(body, cancellationToken);
5050
}
5151
}

src/corelib/ContentDeliveryNetworks/v1/ContentDeliveryNetworkService.cs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ namespace OpenStack.ContentDeliveryNetworks.v1
2121
public class ContentDeliveryNetworkService : IContentDeliveryNetworkService
2222
{
2323
private readonly IAuthenticationProvider _authenticationProvider;
24-
private readonly ServiceUrlBuilder _urlBuilder;
24+
private readonly ServiceEndpoint _endpoint;
2525

2626
/// <summary>
2727
/// Initializes a new instance of the <see cref="ContentDeliveryNetworkService"/> class.
@@ -39,7 +39,7 @@ public ContentDeliveryNetworkService(IAuthenticationProvider authenticationProvi
3939
throw new ArgumentException("region cannot be null or empty", "region");
4040

4141
_authenticationProvider = authenticationProvider;
42-
_urlBuilder = new ServiceUrlBuilder(ServiceType.ContentDeliveryNetwork, authenticationProvider, region, useInternalUrl);
42+
_endpoint = new ServiceEndpoint(ServiceType.ContentDeliveryNetwork, authenticationProvider, region, useInternalUrl);
4343
}
4444

4545
/// <inheritdoc />
@@ -48,7 +48,7 @@ public ContentDeliveryNetworkService(IAuthenticationProvider authenticationProvi
4848
if (string.IsNullOrEmpty(flavorId))
4949
throw new ArgumentNullException("flavorId");
5050

51-
string endpoint = await _urlBuilder.GetEndpoint(cancellationToken).ConfigureAwait(false);
51+
string endpoint = await _endpoint.GetEndpoint(cancellationToken).ConfigureAwait(false);
5252

5353
return await endpoint
5454
.AppendPathSegments("flavors", flavorId)
@@ -60,7 +60,7 @@ public ContentDeliveryNetworkService(IAuthenticationProvider authenticationProvi
6060
/// <inheritdoc />
6161
public async Task<IEnumerable<Flavor>> ListFlavorsAsync(CancellationToken cancellationToken = default(CancellationToken))
6262
{
63-
string endpoint = await _urlBuilder.GetEndpoint(cancellationToken).ConfigureAwait(false);
63+
string endpoint = await _endpoint.GetEndpoint(cancellationToken).ConfigureAwait(false);
6464

6565
return await endpoint
6666
.AppendPathSegments("flavors")
@@ -72,7 +72,7 @@ public ContentDeliveryNetworkService(IAuthenticationProvider authenticationProvi
7272
/// <inheritdoc />
7373
public async Task PingAsync(CancellationToken cancellationToken = default(CancellationToken))
7474
{
75-
string endpoint = await _urlBuilder.GetEndpoint(cancellationToken).ConfigureAwait(false);
75+
string endpoint = await _endpoint.GetEndpoint(cancellationToken).ConfigureAwait(false);
7676

7777
await endpoint
7878
.AppendPathSegments("ping")
@@ -84,7 +84,7 @@ await endpoint
8484
/// <inheritdoc />
8585
public async Task<IPage<Service>> ListServicesAsync(string startServiceId = null, int? pageSize = null, CancellationToken cancellationToken = default(CancellationToken))
8686
{
87-
string endpoint = await _urlBuilder.GetEndpoint(cancellationToken).ConfigureAwait(false);
87+
string endpoint = await _endpoint.GetEndpoint(cancellationToken).ConfigureAwait(false);
8888
string url = endpoint
8989
.AppendPathSegments("services")
9090
.SetQueryParams(new
@@ -115,7 +115,7 @@ private async Task<ServiceCollection> ListServicesAsync(Url url, CancellationTok
115115
if (string.IsNullOrEmpty(serviceId))
116116
throw new ArgumentNullException("serviceId");
117117

118-
string endpoint = await _urlBuilder.GetEndpoint(cancellationToken).ConfigureAwait(false);
118+
string endpoint = await _endpoint.GetEndpoint(cancellationToken).ConfigureAwait(false);
119119

120120
return await endpoint
121121
.AppendPathSegments("services", serviceId)
@@ -130,7 +130,7 @@ private async Task<ServiceCollection> ListServicesAsync(Url url, CancellationTok
130130
if (service == null)
131131
throw new ArgumentNullException("service");
132132

133-
string endpoint = await _urlBuilder.GetEndpoint(cancellationToken).ConfigureAwait(false);
133+
string endpoint = await _endpoint.GetEndpoint(cancellationToken).ConfigureAwait(false);
134134

135135
var response = await endpoint
136136
.AppendPathSegments("services")
@@ -148,7 +148,7 @@ private async Task<ServiceCollection> ListServicesAsync(Url url, CancellationTok
148148
if (string.IsNullOrEmpty(serviceId))
149149
throw new ArgumentNullException("serviceId");
150150

151-
string endpoint = await _urlBuilder.GetEndpoint(cancellationToken).ConfigureAwait(false);
151+
string endpoint = await _endpoint.GetEndpoint(cancellationToken).ConfigureAwait(false);
152152

153153
await endpoint
154154
.AppendPathSegments("services", serviceId)
@@ -166,7 +166,7 @@ await endpoint
166166
if (patch == null)
167167
throw new ArgumentNullException("patch");
168168

169-
string endpoint = await _urlBuilder.GetEndpoint(cancellationToken).ConfigureAwait(false);
169+
string endpoint = await _endpoint.GetEndpoint(cancellationToken).ConfigureAwait(false);
170170

171171
await endpoint
172172
.AppendPathSegments("services", serviceId)
@@ -183,7 +183,7 @@ await endpoint
183183
if (string.IsNullOrEmpty(url))
184184
throw new ArgumentNullException("url");
185185

186-
string endpoint = await _urlBuilder.GetEndpoint(cancellationToken).ConfigureAwait(false);
186+
string endpoint = await _endpoint.GetEndpoint(cancellationToken).ConfigureAwait(false);
187187

188188
await endpoint
189189
.AppendPathSegments("services", serviceId, "assets")
@@ -200,7 +200,7 @@ await endpoint
200200
if (string.IsNullOrEmpty(serviceId))
201201
throw new ArgumentNullException("serviceId");
202202

203-
string endpoint = await _urlBuilder.GetEndpoint(cancellationToken).ConfigureAwait(false);
203+
string endpoint = await _endpoint.GetEndpoint(cancellationToken).ConfigureAwait(false);
204204

205205
await endpoint
206206
.AppendPathSegments("services", serviceId, "assets")

src/corelib/Networking/v2/NetworkingApiBuilder.cs

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public class NetworkingApiBuilder
2222
protected readonly IAuthenticationProvider AuthenticationProvider;
2323

2424
/// <summary />
25-
protected readonly ServiceUrlBuilder UrlBuilder;
25+
protected readonly ServiceEndpoint Endpoint;
2626

2727
/// <summary>
2828
/// Initializes a new instance of the <see cref="NetworkingApiBuilder"/> class.
@@ -40,7 +40,7 @@ public NetworkingApiBuilder(IServiceType serviceType, IAuthenticationProvider au
4040
throw new ArgumentException("region cannot be null or empty", "region");
4141

4242
AuthenticationProvider = authenticationProvider;
43-
UrlBuilder = new ServiceUrlBuilder(serviceType, authenticationProvider, region);
43+
Endpoint = new ServiceEndpoint(serviceType, authenticationProvider, region);
4444
}
4545

4646
#region Networks
@@ -53,7 +53,7 @@ public NetworkingApiBuilder(IServiceType serviceType, IAuthenticationProvider au
5353
/// </returns>
5454
public async Task<PreparedRequest> ListNetworksAsync(CancellationToken cancellationToken = default(CancellationToken))
5555
{
56-
Url endpoint = await UrlBuilder.GetEndpoint(cancellationToken).ConfigureAwait(false);
56+
Url endpoint = await Endpoint.GetEndpoint(cancellationToken).ConfigureAwait(false);
5757

5858
return endpoint
5959
.AppendPathSegments("networks")
@@ -71,7 +71,7 @@ public NetworkingApiBuilder(IServiceType serviceType, IAuthenticationProvider au
7171
/// </returns>
7272
public virtual async Task<PreparedRequest> GetNetworkAsync(string networkId, CancellationToken cancellationToken = default(CancellationToken))
7373
{
74-
Url endpoint = await UrlBuilder.GetEndpoint(cancellationToken).ConfigureAwait(false);
74+
Url endpoint = await Endpoint.GetEndpoint(cancellationToken).ConfigureAwait(false);
7575

7676
return endpoint
7777
.AppendPathSegments("networks", networkId)
@@ -89,7 +89,7 @@ public NetworkingApiBuilder(IServiceType serviceType, IAuthenticationProvider au
8989
/// </returns>
9090
public virtual async Task<PreparedRequest> CreateNetworkAsync(object network, CancellationToken cancellationToken = default(CancellationToken))
9191
{
92-
Url endpoint = await UrlBuilder.GetEndpoint(cancellationToken).ConfigureAwait(false);
92+
Url endpoint = await Endpoint.GetEndpoint(cancellationToken).ConfigureAwait(false);
9393

9494
return endpoint
9595
.AppendPathSegments("networks")
@@ -107,7 +107,7 @@ public NetworkingApiBuilder(IServiceType serviceType, IAuthenticationProvider au
107107
/// </returns>
108108
public virtual async Task<PreparedRequest> CreateNetworksAsync(IEnumerable<object> networks, CancellationToken cancellationToken = default(CancellationToken))
109109
{
110-
Url endpoint = await UrlBuilder.GetEndpoint(cancellationToken).ConfigureAwait(false);
110+
Url endpoint = await Endpoint.GetEndpoint(cancellationToken).ConfigureAwait(false);
111111

112112
return endpoint
113113
.AppendPathSegments("networks")
@@ -126,7 +126,7 @@ public NetworkingApiBuilder(IServiceType serviceType, IAuthenticationProvider au
126126
/// </returns>
127127
public virtual async Task<PreparedRequest> UpdateNetworkAsync(string networkId, object network, CancellationToken cancellationToken = default(CancellationToken))
128128
{
129-
string endpoint = await UrlBuilder.GetEndpoint(cancellationToken).ConfigureAwait(false);
129+
string endpoint = await Endpoint.GetEndpoint(cancellationToken).ConfigureAwait(false);
130130

131131
return endpoint
132132
.AppendPathSegments("networks", networkId)
@@ -141,7 +141,7 @@ public NetworkingApiBuilder(IServiceType serviceType, IAuthenticationProvider au
141141
/// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param>
142142
public virtual async Task<PreparedRequest> DeleteNetworkAsync(string networkId, CancellationToken cancellationToken = default(CancellationToken))
143143
{
144-
Url endpoint = await UrlBuilder.GetEndpoint(cancellationToken).ConfigureAwait(false);
144+
Url endpoint = await Endpoint.GetEndpoint(cancellationToken).ConfigureAwait(false);
145145

146146
return (PreparedRequest)endpoint
147147
.AppendPathSegments("networks", networkId)
@@ -162,7 +162,7 @@ public NetworkingApiBuilder(IServiceType serviceType, IAuthenticationProvider au
162162
/// </returns>
163163
public virtual async Task<PreparedRequest> ListSubnetsAsync(CancellationToken cancellationToken = default(CancellationToken))
164164
{
165-
Url endpoint = await UrlBuilder.GetEndpoint(cancellationToken).ConfigureAwait(false);
165+
Url endpoint = await Endpoint.GetEndpoint(cancellationToken).ConfigureAwait(false);
166166

167167
return endpoint
168168
.AppendPathSegment("subnets")
@@ -180,7 +180,7 @@ public NetworkingApiBuilder(IServiceType serviceType, IAuthenticationProvider au
180180
/// </returns>
181181
public virtual async Task<PreparedRequest> CreateSubnetAsync(object subnet, CancellationToken cancellationToken = default(CancellationToken))
182182
{
183-
Url endpoint = await UrlBuilder.GetEndpoint(cancellationToken).ConfigureAwait(false);
183+
Url endpoint = await Endpoint.GetEndpoint(cancellationToken).ConfigureAwait(false);
184184

185185
return endpoint
186186
.AppendPathSegments("subnets")
@@ -198,7 +198,7 @@ public NetworkingApiBuilder(IServiceType serviceType, IAuthenticationProvider au
198198
/// </returns>
199199
public virtual async Task<PreparedRequest> CreateSubnetsAsync(IEnumerable<object> subnets, CancellationToken cancellationToken = default(CancellationToken))
200200
{
201-
Url endpoint = await UrlBuilder.GetEndpoint(cancellationToken).ConfigureAwait(false);
201+
Url endpoint = await Endpoint.GetEndpoint(cancellationToken).ConfigureAwait(false);
202202

203203
return endpoint
204204
.AppendPathSegments("subnets")
@@ -216,7 +216,7 @@ public NetworkingApiBuilder(IServiceType serviceType, IAuthenticationProvider au
216216
/// </returns>
217217
public virtual async Task<PreparedRequest> GetSubnetAsync(string subnetId, CancellationToken cancellationToken = default(CancellationToken))
218218
{
219-
Url endpoint = await UrlBuilder.GetEndpoint(cancellationToken).ConfigureAwait(false);
219+
Url endpoint = await Endpoint.GetEndpoint(cancellationToken).ConfigureAwait(false);
220220

221221
return endpoint
222222
.AppendPathSegments("subnets", subnetId)
@@ -235,7 +235,7 @@ public NetworkingApiBuilder(IServiceType serviceType, IAuthenticationProvider au
235235
/// </returns>
236236
public virtual async Task<PreparedRequest> UpdateSubnetAsync(string subnetId, object subnet, CancellationToken cancellationToken = default(CancellationToken))
237237
{
238-
string endpoint = await UrlBuilder.GetEndpoint(cancellationToken).ConfigureAwait(false);
238+
string endpoint = await Endpoint.GetEndpoint(cancellationToken).ConfigureAwait(false);
239239

240240
return endpoint
241241
.AppendPathSegments("subnets", subnetId)
@@ -250,7 +250,7 @@ public NetworkingApiBuilder(IServiceType serviceType, IAuthenticationProvider au
250250
/// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param>
251251
public virtual async Task<PreparedRequest> DeleteSubnetAsync(string subnetId, CancellationToken cancellationToken = default(CancellationToken))
252252
{
253-
Url endpoint = await UrlBuilder.GetEndpoint(cancellationToken).ConfigureAwait(false);
253+
Url endpoint = await Endpoint.GetEndpoint(cancellationToken).ConfigureAwait(false);
254254

255255
return (PreparedRequest)endpoint
256256
.AppendPathSegments("subnets", subnetId)
@@ -270,7 +270,7 @@ public NetworkingApiBuilder(IServiceType serviceType, IAuthenticationProvider au
270270
/// </returns>
271271
public virtual async Task<PreparedRequest> ListPortsAsync(CancellationToken cancellationToken = default(CancellationToken))
272272
{
273-
Url endpoint = await UrlBuilder.GetEndpoint(cancellationToken).ConfigureAwait(false);
273+
Url endpoint = await Endpoint.GetEndpoint(cancellationToken).ConfigureAwait(false);
274274

275275
return endpoint
276276
.AppendPathSegment("ports")
@@ -288,7 +288,7 @@ public NetworkingApiBuilder(IServiceType serviceType, IAuthenticationProvider au
288288
/// </returns>
289289
public virtual async Task<PreparedRequest> CreatePortAsync(object port, CancellationToken cancellationToken = default(CancellationToken))
290290
{
291-
Url endpoint = await UrlBuilder.GetEndpoint(cancellationToken).ConfigureAwait(false);
291+
Url endpoint = await Endpoint.GetEndpoint(cancellationToken).ConfigureAwait(false);
292292

293293
return endpoint
294294
.AppendPathSegments("ports")
@@ -306,7 +306,7 @@ public NetworkingApiBuilder(IServiceType serviceType, IAuthenticationProvider au
306306
/// </returns>
307307
public virtual async Task<PreparedRequest> CreatePortsAsync(IEnumerable<object> ports, CancellationToken cancellationToken = default(CancellationToken))
308308
{
309-
Url endpoint = await UrlBuilder.GetEndpoint(cancellationToken).ConfigureAwait(false);
309+
Url endpoint = await Endpoint.GetEndpoint(cancellationToken).ConfigureAwait(false);
310310

311311
return endpoint
312312
.AppendPathSegments("ports")
@@ -324,7 +324,7 @@ public NetworkingApiBuilder(IServiceType serviceType, IAuthenticationProvider au
324324
/// </returns>
325325
public virtual async Task<PreparedRequest> GetPortAsync(string portId, CancellationToken cancellationToken = default(CancellationToken))
326326
{
327-
Url endpoint = await UrlBuilder.GetEndpoint(cancellationToken).ConfigureAwait(false);
327+
Url endpoint = await Endpoint.GetEndpoint(cancellationToken).ConfigureAwait(false);
328328

329329
return endpoint
330330
.AppendPathSegments("ports", portId)
@@ -343,7 +343,7 @@ public NetworkingApiBuilder(IServiceType serviceType, IAuthenticationProvider au
343343
/// </returns>
344344
public virtual async Task<PreparedRequest> UpdatePortAsync(string portId, object port, CancellationToken cancellationToken = default(CancellationToken))
345345
{
346-
string endpoint = await UrlBuilder.GetEndpoint(cancellationToken).ConfigureAwait(false);
346+
string endpoint = await Endpoint.GetEndpoint(cancellationToken).ConfigureAwait(false);
347347

348348
return endpoint
349349
.AppendPathSegments("ports", portId)
@@ -358,7 +358,7 @@ public NetworkingApiBuilder(IServiceType serviceType, IAuthenticationProvider au
358358
/// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param>
359359
public virtual async Task<PreparedRequest> DeletePortAsync(string portId, CancellationToken cancellationToken = default(CancellationToken))
360360
{
361-
Url endpoint = await UrlBuilder.GetEndpoint(cancellationToken).ConfigureAwait(false);
361+
Url endpoint = await Endpoint.GetEndpoint(cancellationToken).ConfigureAwait(false);
362362

363363
return (PreparedRequest)endpoint
364364
.AppendPathSegments("ports", portId)

src/corelib/OpenStack.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@
8282
<Compile Include="Authentication\IAuthenticationProvider.cs" />
8383
<Compile Include="Authentication\NamespaceDoc.cs" />
8484
<Compile Include="Authentication\ServiceType.cs" />
85-
<Compile Include="Authentication\ServiceUrlBuilder.cs" />
8685
<Compile Include="Compute\ComputeOperationFailedException.cs" />
8786
<Compile Include="Compute\NamespaceDoc.cs" />
8887
<Compile Include="Compute\v2_1\Actions\RescueServerRequest.cs" />
@@ -857,6 +856,7 @@
857856
<Compile Include="Serialization\TimeSpanInSecondsConverter.cs" />
858857
<Compile Include="Serialization\TolerantEnumConverter.cs" />
859858
<Compile Include="Serialization\RootWrapperConverter.cs" />
859+
<Compile Include="ServiceEndpoint.cs" />
860860
<Compile Include="Testing\HttpTest.cs" />
861861
<Compile Include="Testing\NamespaceDoc.cs" />
862862
</ItemGroup>

0 commit comments

Comments
 (0)