Skip to content

Commit 9c53fa4

Browse files
committed
Improve creation of a service for a single domain
Make the most simple case, where the CDN service is only i fronting a single domain, easier.
1 parent 72a3900 commit 9c53fa4

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

src/corelib/ContentDeliveryNetworks/v1/ServiceDefinition.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,18 @@ namespace OpenStack.ContentDeliveryNetworks.v1
99
/// <threadsafety static="true" instance="false"/>
1010
public class ServiceDefinition
1111
{
12+
/// <summary>
13+
/// Initializes a new instance of the <see cref="ServiceDefinition"/> class.
14+
/// </summary>
15+
/// <param name="name">The service name.</param>
16+
/// <param name="flavorId">The flavor identifier.</param>
17+
/// <param name="domain">The service domain.</param>
18+
/// <param name="origin">The service asset origin.</param>
19+
public ServiceDefinition(string name, string flavorId, string domain, string origin)
20+
: this(name, flavorId, new[] {new ServiceDomain(domain)}, new[] {new ServiceOrigin(origin)})
21+
{
22+
}
23+
1224
/// <summary>
1325
/// Initializes a new instance of the <see cref="ServiceDefinition"/> class.
1426
/// </summary>

src/testing/unit/ContentDeliveryNetworks/v1/ServiceTests.cs

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -71,16 +71,8 @@ public void CreateService()
7171
response.Headers.Location = "http://api.com".AppendPathSegments("services", "service-id").ToUri();
7272
httpTest.ResponseQueue.Enqueue(response);
7373

74-
var service = new ServiceDefinition("service-name", "flavor-id", null, null)
74+
var service = new ServiceDefinition("service-name", "flavor-id", "www.example.com", "example.com")
7575
{
76-
Domains =
77-
{
78-
new ServiceDomain("example.com")
79-
},
80-
Origins =
81-
{
82-
new ServiceOrigin("assets.example.com")
83-
},
8476
Caches =
8577
{
8678
new ServiceCache("keep-one-day", TimeSpan.FromDays(1))

0 commit comments

Comments
 (0)