Skip to content

Commit 69a1b29

Browse files
committed
Enable UseInternalUrl in Compute
1 parent e910af1 commit 69a1b29

6 files changed

Lines changed: 29 additions & 26 deletions

File tree

src/corelib/Compute/v2_1/ComputeApiBuilder.cs

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,19 +32,26 @@ public class ComputeApiBuilder
3232
/// <summary />
3333
protected readonly ServiceEndpoint Endpoint;
3434

35-
/// <summary />
36-
public ComputeApiBuilder(IServiceType serviceType, IAuthenticationProvider authenticationProvider, string region)
37-
: this(serviceType, authenticationProvider, region, "2.1")
35+
/// <summary>
36+
/// Initializes a new instance of the <see cref="ComputeApiBuilder"/> class.
37+
/// </summary>
38+
/// <param name="serviceType">The service type for the desired compute provider.</param>
39+
/// <param name="authenticationProvider">The authentication provider.</param>
40+
/// <param name="region">The region.</param>
41+
/// <param name="useInternalUrl">if set to <c>true</c> uses the internal URLs specified in the ServiceCatalog, otherwise the public URLs are used.</param>
42+
public ComputeApiBuilder(IServiceType serviceType, IAuthenticationProvider authenticationProvider, string region, bool useInternalUrl)
43+
: this(serviceType, authenticationProvider, region, useInternalUrl, "2.1")
3844
{ }
3945

4046
/// <summary>
4147
/// Initializes a new instance of the <see cref="ComputeApiBuilder"/> class.
4248
/// </summary>
4349
/// <param name="serviceType">The service type for the desired compute provider.</param>
4450
/// <param name="authenticationProvider">The authentication provider.</param>
51+
/// <param name="useInternalUrl">if set to <c>true</c> uses the internal URLs specified in the ServiceCatalog, otherwise the public URLs are used.</param>
4552
/// <param name="region">The region.</param>
46-
/// <param name="microversion">The requested microversion.</param>
47-
protected ComputeApiBuilder(IServiceType serviceType, IAuthenticationProvider authenticationProvider, string region, string microversion)
53+
/// <param name="microversion">The requested API microversion.</param>
54+
protected ComputeApiBuilder(IServiceType serviceType, IAuthenticationProvider authenticationProvider, string region, bool useInternalUrl, string microversion)
4855
{
4956
if (serviceType == null)
5057
throw new ArgumentNullException("serviceType");
@@ -54,7 +61,7 @@ protected ComputeApiBuilder(IServiceType serviceType, IAuthenticationProvider au
5461
throw new ArgumentException("region cannot be null or empty", "region");
5562

5663
AuthenticationProvider = authenticationProvider;
57-
Endpoint = new ServiceEndpoint(serviceType, authenticationProvider, region, false, microversion, MicroversionHeader);
64+
Endpoint = new ServiceEndpoint(serviceType, authenticationProvider, region, useInternalUrl, microversion, MicroversionHeader);
5865
}
5966

6067
#region Servers

src/corelib/Compute/v2_1/ComputeService.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,10 @@ public class ComputeService
2222
/// </summary>
2323
/// <param name="authenticationProvider">The authentication provider.</param>
2424
/// <param name="region">The region.</param>
25-
public ComputeService(IAuthenticationProvider authenticationProvider, string region)
25+
/// <param name="useInternalUrl">if set to <c>true</c> uses the internal URLs specified in the ServiceCatalog, otherwise the public URLs are used.</param>
26+
public ComputeService(IAuthenticationProvider authenticationProvider, string region, bool useInternalUrl = false)
2627
{
27-
_computeApi = new ComputeApiBuilder(ServiceType.Compute, authenticationProvider, region);
28+
_computeApi = new ComputeApiBuilder(ServiceType.Compute, authenticationProvider, region, useInternalUrl);
2829
}
2930

3031
#region Servers

src/corelib/Compute/v2_2/ComputeApiBuilder.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@ namespace OpenStack.Compute.v2_2
77
public class ComputeApiBuilder : v2_1.ComputeApiBuilder
88
{
99
/// <summary />
10-
public ComputeApiBuilder(IServiceType serviceType, IAuthenticationProvider authenticationProvider, string region)
11-
: this(serviceType, authenticationProvider, region, "2.2")
10+
public ComputeApiBuilder(IServiceType serviceType, IAuthenticationProvider authenticationProvider, string region, bool useInternalUrl)
11+
: this(serviceType, authenticationProvider, region, useInternalUrl, "2.2")
1212
{ }
1313

1414
/// <summary />
15-
protected ComputeApiBuilder(IServiceType serviceType, IAuthenticationProvider authenticationProvider, string region, string microversion)
16-
: base(serviceType, authenticationProvider, region, microversion)
15+
protected ComputeApiBuilder(IServiceType serviceType, IAuthenticationProvider authenticationProvider, string region, bool useInternalUrl, string microversion)
16+
: base(serviceType, authenticationProvider, region, useInternalUrl, microversion)
1717
{ }
1818
}
1919
}

src/corelib/Compute/v2_2/ComputeService.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ public class ComputeService
1212
private readonly ComputeApiBuilder _computeApiBuilder;
1313

1414
/// <summary />
15-
public ComputeService(IAuthenticationProvider authenticationProvider, string region)
15+
public ComputeService(IAuthenticationProvider authenticationProvider, string region, bool useInternalUrl)
1616
{
17-
_computeApiBuilder = new ComputeApiBuilder(ServiceType.Compute, authenticationProvider, region);
17+
_computeApiBuilder = new ComputeApiBuilder(ServiceType.Compute, authenticationProvider, region, useInternalUrl);
1818
}
1919

2020
#region Servers

src/corelib/Compute/v2_6/ComputeApiBuilder.cs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
using System.ComponentModel;
33
using System.Threading;
44
using System.Threading.Tasks;
5-
using Flurl;
65
using Flurl.Extensions;
76
using Flurl.Http;
87
using OpenStack.Authentication;
@@ -14,13 +13,13 @@ namespace OpenStack.Compute.v2_6
1413
public class ComputeApiBuilder : v2_2.ComputeApiBuilder
1514
{
1615
/// <inheritdoc />
17-
public ComputeApiBuilder(IServiceType serviceType, IAuthenticationProvider authenticationProvider, string region)
18-
: this(serviceType, authenticationProvider, region, "2.6")
16+
public ComputeApiBuilder(IServiceType serviceType, IAuthenticationProvider authenticationProvider, string region, bool useInternalUrl)
17+
: this(serviceType, authenticationProvider, region, useInternalUrl, "2.6")
1918
{ }
2019

2120
/// <inheritdoc />
22-
protected ComputeApiBuilder(IServiceType serviceType, IAuthenticationProvider authenticationProvider, string region, string microversion)
23-
: base(serviceType, authenticationProvider, region, microversion)
21+
protected ComputeApiBuilder(IServiceType serviceType, IAuthenticationProvider authenticationProvider, string region, bool useInternalUrl, string microversion)
22+
: base(serviceType, authenticationProvider, region, useInternalUrl, microversion)
2423
{ }
2524

2625
#pragma warning disable 809

src/corelib/Compute/v2_6/ComputeService.cs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,10 @@ public class ComputeService
1010
{
1111
private readonly ComputeApiBuilder _computeApiBuilder;
1212

13-
/// <summary>
14-
/// Initializes a new instance of the <see cref="ComputeService"/> class.
15-
/// </summary>
16-
/// <param name="authenticationProvider">The authentication provider.</param>
17-
/// <param name="region">The region.</param>
18-
public ComputeService(IAuthenticationProvider authenticationProvider, string region)
13+
/// <summary />
14+
public ComputeService(IAuthenticationProvider authenticationProvider, string region, bool useInternalUrl = false)
1915
{
20-
_computeApiBuilder = new ComputeApiBuilder(ServiceType.Compute, authenticationProvider, region);
16+
_computeApiBuilder = new ComputeApiBuilder(ServiceType.Compute, authenticationProvider, region, useInternalUrl);
2117
}
2218

2319
#region Servers

0 commit comments

Comments
 (0)