Skip to content

Commit 26ccd15

Browse files
committed
Merge pull request #590 from carolynvs/standardize-naming-conventions
Standardize naming conventions
2 parents ddff6b1 + 58b3def commit 26ccd15

50 files changed

Lines changed: 546 additions & 504 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/corelib/Compute/v2_1/ComputeService.cs

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

src/corelib/Compute/v2_1/ComputeServiceExtensions.cs

Lines changed: 18 additions & 18 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.ListServerReferencesAsync" />
40-
public static IPage<ServerReference> ListServerReferences(this ComputeService service, ServerListOptions options = null)
39+
/// <inheritdoc cref="ComputeService.ListServerSummariesAsync" />
40+
public static IPage<ServerSummary> ListServerSummaries(this ComputeService service, ServerListOptions options = null)
4141
{
42-
return service.ListServerReferencesAsync(options).ForceSynchronous();
42+
return service.ListServerSummariesAsync(options).ForceSynchronous();
4343
}
4444

4545
/// <inheritdoc cref="ComputeService.ListServersAsync" />
@@ -176,16 +176,16 @@ public static Flavor GetFlavor(this ComputeService service, Identifier flavorId)
176176
return service.GetFlavorAsync(flavorId).ForceSynchronous();
177177
}
178178

179-
/// <inheritdoc cref="ComputeService.ListFlavorsAsync" />
180-
public static IEnumerable<FlavorReference> ListFlavors(this ComputeService service)
179+
/// <inheritdoc cref="ComputeService.ListFlavorSummariesAsync" />
180+
public static IEnumerable<FlavorSummary> ListFlavorSummaries(this ComputeService service)
181181
{
182-
return service.ListFlavorsAsync().ForceSynchronous();
182+
return service.ListFlavorSummariesAsync().ForceSynchronous();
183183
}
184184

185-
/// <inheritdoc cref="ComputeService.ListFlavorDetailsAsync" />
186-
public static IEnumerable<Flavor> ListFlavorDetails(this ComputeService service)
185+
/// <inheritdoc cref="ComputeService.ListFlavorsAsync" />
186+
public static IEnumerable<Flavor> ListFlavors(this ComputeService service)
187187
{
188-
return service.ListFlavorDetailsAsync().ForceSynchronous();
188+
return service.ListFlavorsAsync().ForceSynchronous();
189189
}
190190
#endregion
191191

@@ -220,16 +220,16 @@ public static void CreateImagMetadata(this ComputeService service, Identifier im
220220
service.CreateImagMetadataAsync(imageId, key, value).ForceSynchronous();
221221
}
222222

223-
/// <inheritdoc cref="ComputeService.ListImagesAsync" />
224-
public static IPage<ImageReference> ListImages(this ComputeService service, ImageListOptions options = null)
223+
/// <inheritdoc cref="ComputeService.ListImageSummariesAsync" />
224+
public static IPage<ImageSummary> ListImageSummaries(this ComputeService service, ImageListOptions options = null)
225225
{
226-
return service.ListImagesAsync(options).ForceSynchronous();
226+
return service.ListImageSummariesAsync(options).ForceSynchronous();
227227
}
228228

229-
/// <inheritdoc cref="ComputeService.ListImageDetailsAsync" />
230-
public static IPage<Image> ListImageDetails(this ComputeService service, ImageListOptions options = null)
229+
/// <inheritdoc cref="ComputeService.ListImagesAsync" />
230+
public static IPage<Image> ListImages(this ComputeService service, ImageListOptions options = null)
231231
{
232-
return service.ListImageDetailsAsync(options).ForceSynchronous();
232+
return service.ListImagesAsync(options).ForceSynchronous();
233233
}
234234

235235
/// <inheritdoc cref="ComputeService.UpdateImageMetadataAsync" />
@@ -301,7 +301,7 @@ public static void DetachVolume(this ComputeService service, Identifier serverId
301301

302302
#region KeyPairs
303303
/// <inheritdoc cref="ComputeService.GetKeyPairAsync" />
304-
public static KeyPairDetails GetKeyPair(this ComputeService service, string keypairName)
304+
public static KeyPair GetKeyPair(this ComputeService service, string keypairName)
305305
{
306306
return service.GetKeyPairAsync(keypairName).ForceSynchronous();
307307
}
@@ -313,13 +313,13 @@ public static KeyPairResponse CreateKeyPair(this ComputeService service, KeyPair
313313
}
314314

315315
/// <inheritdoc cref="ComputeService.ImportKeyPairAsync" />
316-
public static KeyPair ImportKeyPair(this ComputeService service, KeyPairDefinition keyPair)
316+
public static KeyPairSummary ImportKeyPair(this ComputeService service, KeyPairDefinition keyPair)
317317
{
318318
return service.ImportKeyPairAsync(keyPair).ForceSynchronous();
319319
}
320320

321321
/// <inheritdoc cref="ComputeService.ListKeyPairsAsync" />
322-
public static IEnumerable<KeyPair> ListKeyPairs(this ComputeService service)
322+
public static IEnumerable<KeyPairSummary> ListKeyPairs(this ComputeService service)
323323
{
324324
return service.ListKeyPairsAsync().ForceSynchronous();
325325
}

src/corelib/Compute/v2_1/Flavor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ namespace OpenStack.Compute.v2_1
55
{
66
/// <summary />
77
[JsonConverterWithConstructor(typeof(RootWrapperConverter), "flavor")]
8-
public class Flavor : FlavorReference
8+
public class Flavor : FlavorSummary
99
{
1010
/// <summary />
1111
[JsonProperty("disk")]

src/corelib/Compute/v2_1/FlavorReference.cs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
using System.Threading.Tasks;
55
using Newtonsoft.Json;
66
using Newtonsoft.Json.Linq;
7+
using OpenStack.Compute.v2_1.Serialization;
78
using OpenStack.Serialization;
89

910
namespace OpenStack.Compute.v2_1
@@ -15,21 +16,17 @@ public class FlavorReference : IHaveExtraData, IServiceResource
1516
[JsonProperty("id")]
1617
public Identifier Id { get; set; }
1718

18-
/// <summary /> // In some cases, only the id is populated. Use GetFlavor if Name is null.
19-
[JsonProperty("name")]
20-
public string Name { get; set; }
21-
2219
/// <summary />
2320
[JsonExtensionData]
2421
IDictionary<string, JToken> IHaveExtraData.Data { get; set; } = new Dictionary<string, JToken>();
2522

2623
object IServiceResource.Owner { get; set; }
2724

28-
/// <inheritdoc cref="ComputeApiBuilder.GetFlavorAsync{T}" />
29-
/// <exception cref="InvalidOperationException">When the <see cref="FlavorReference"/> instance was not constructed by the <see cref="ComputeService"/>, as it is missing the appropriate internal state to execute service calls.</exception>
25+
/// <inheritdoc cref="ComputeApi.GetFlavorAsync{T}" />
26+
/// <exception cref="InvalidOperationException">When the <see cref="FlavorSummary"/> instance was not constructed by the <see cref="ComputeService"/>, as it is missing the appropriate internal state to execute service calls.</exception>
3027
public Task<Flavor> GetFlavorAsync(CancellationToken cancellationToken = default(CancellationToken))
3128
{
32-
var owner = this.GetOwnerOrThrow<ComputeApiBuilder>();
29+
var owner = this.GetOwnerOrThrow<ComputeApi>();
3330
return owner.GetFlavorAsync<Flavor>(Id, cancellationToken);
3431
}
3532
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
using Newtonsoft.Json;
2+
3+
namespace OpenStack.Compute.v2_1
4+
{
5+
/// <summary />
6+
public class FlavorSummary : FlavorReference
7+
{
8+
/// <summary /> // In some cases, only the id is populated. Use GetFlavor if Name is null.
9+
[JsonProperty("name")]
10+
public string Name { get; set; }
11+
}
12+
}

src/corelib/Compute/v2_1/Image.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,14 @@
44
using System.Threading;
55
using System.Threading.Tasks;
66
using Newtonsoft.Json;
7+
using OpenStack.Compute.v2_1.Serialization;
78
using OpenStack.Serialization;
89

910
namespace OpenStack.Compute.v2_1
1011
{
1112
/// <summary />
1213
[JsonConverterWithConstructor(typeof(RootWrapperConverter), "image")]
13-
public class Image : ImageReference
14+
public class Image : ImageSummary
1415
{
1516
/// <summary>
1617
/// Initializes a new instance of the <see cref="Image"/> class.
@@ -70,11 +71,11 @@ public ImageType Type
7071
}
7172
}
7273

73-
/// <inheritdoc cref="ComputeApiBuilder.WaitForImageStatusAsync{TImage,TStatus}" />
74+
/// <inheritdoc cref="ComputeApi.WaitForImageStatusAsync{TImage,TStatus}" />
7475
/// <exception cref="InvalidOperationException">When this instance was not constructed by the <see cref="ComputeService"/>, as it is missing the appropriate internal state to execute service calls.</exception>
7576
public async Task WaitForStatus(ImageStatus status, TimeSpan? refreshDelay = null, TimeSpan? timeout = null, IProgress<bool> progress = null, CancellationToken cancellationToken = default(CancellationToken))
7677
{
77-
var owner = this.GetOwnerOrThrow<ComputeApiBuilder>();
78+
var owner = this.GetOwnerOrThrow<ComputeApi>();
7879
var result = await owner.WaitForImageStatusAsync<Image, ImageStatus>(Id, status, refreshDelay, timeout, progress, cancellationToken).ConfigureAwait(false);
7980
result.CopyProperties(this);
8081
}
@@ -85,7 +86,7 @@ public ImageType Type
8586
return WaitForStatus(ImageStatus.Active, refreshDelay, timeout, progress, cancellationToken);
8687
}
8788

88-
/// <inheritdoc cref="ComputeApiBuilder.WaitUntilImageIsDeletedAsync{TImage,TStatus}" />
89+
/// <inheritdoc cref="ComputeApi.WaitUntilImageIsDeletedAsync{TImage,TStatus}" />
8990
/// <exception cref="InvalidOperationException">When this instance was not constructed by the <see cref="ComputeService"/>, as it is missing the appropriate internal state to execute service calls.</exception>
9091
public override async Task WaitUntilDeletedAsync(TimeSpan? refreshDelay = null, TimeSpan? timeout = null, IProgress<bool> progress = null, CancellationToken cancellationToken = default(CancellationToken))
9192
{

src/corelib/Compute/v2_1/ImageMetadata.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using System.Threading.Tasks;
66
using Newtonsoft.Json;
77
using Newtonsoft.Json.Linq;
8+
using OpenStack.Compute.v2_1.Serialization;
89
using OpenStack.Serialization;
910

1011
namespace OpenStack.Compute.v2_1
@@ -52,7 +53,7 @@ protected void AssertImageIsSet([CallerMemberName]string callerName = "")
5253
public async Task CreateAsync(string key, string value, CancellationToken cancellationToken = default(CancellationToken))
5354
{
5455
AssertImageIsSet();
55-
var compute = this.GetOwnerOrThrow<ComputeApiBuilder>();
56+
var compute = this.GetOwnerOrThrow<ComputeApi>();
5657
await compute.CreateImagMetadataAsync(Image.Id, key, value, cancellationToken);
5758
this[key] = value;
5859
}
@@ -61,7 +62,7 @@ protected void AssertImageIsSet([CallerMemberName]string callerName = "")
6162
public async Task UpdateAsync(bool overwrite = false, CancellationToken cancellationToken = default(CancellationToken))
6263
{
6364
AssertImageIsSet();
64-
var compute = this.GetOwnerOrThrow<ComputeApiBuilder>();
65+
var compute = this.GetOwnerOrThrow<ComputeApi>();
6566
var results = await compute.UpdateImageMetadataAsync<ImageMetadata>(Image.Id, this, overwrite, cancellationToken);
6667
Clear();
6768
foreach (var result in results)
@@ -77,7 +78,7 @@ protected void AssertImageIsSet([CallerMemberName]string callerName = "")
7778
return;
7879

7980
AssertImageIsSet();
80-
var compute = this.GetOwnerOrThrow<ComputeApiBuilder>();
81+
var compute = this.GetOwnerOrThrow<ComputeApi>();
8182
await compute.DeleteImageMetadataAsync(Image.Id, key, cancellationToken);
8283
Remove(key);
8384
}

src/corelib/Compute/v2_1/ImageReference.cs

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
using System.Threading.Tasks;
55
using Newtonsoft.Json;
66
using Newtonsoft.Json.Linq;
7+
using OpenStack.Compute.v2_1.Serialization;
78
using OpenStack.Serialization;
89

910
namespace OpenStack.Compute.v2_1
@@ -12,54 +13,52 @@ namespace OpenStack.Compute.v2_1
1213
public class ImageReference : IHaveExtraData, IServiceResource
1314
{
1415
/// <summary />
16+
[JsonProperty("id")]
1517
public virtual Identifier Id { get; set; }
1618

17-
/// <summary />
18-
public string Name { get; set; }
19-
2019
/// <summary />
2120
[JsonExtensionData]
2221
IDictionary<string, JToken> IHaveExtraData.Data { get; set; } = new Dictionary<string, JToken>();
2322

2423
object IServiceResource.Owner { get; set; }
2524

26-
/// <inheritdoc cref="ComputeApiBuilder.GetImageAsync{T}" />
25+
/// <inheritdoc cref="ComputeApi.GetImageAsync{T}" />
2726
/// <exception cref="InvalidOperationException">When the <see cref="ImageReference"/> instance was not constructed by the <see cref="ComputeService"/>, as it is missing the appropriate internal state to execute service calls.</exception>
2827
public Task<Image> GetImageAsync(CancellationToken cancellationToken = default(CancellationToken))
2928
{
30-
var owner = this.GetOwnerOrThrow<ComputeApiBuilder>();
29+
var owner = this.GetOwnerOrThrow<ComputeApi>();
3130
return owner.GetImageAsync<Image>(Id, cancellationToken);
3231
}
3332

34-
/// <inheritdoc cref="ComputeApiBuilder.GetImageMetadataAsync{T}" />
33+
/// <inheritdoc cref="ComputeApi.GetImageMetadataAsync{T}" />
3534
/// <exception cref="InvalidOperationException">When the <see cref="ImageReference"/> instance was not constructed by the <see cref="ComputeService"/>, as it is missing the appropriate internal state to execute service calls.</exception>
3635
public Task<ImageMetadata> GetMetadataAsync(CancellationToken cancellationToken = default(CancellationToken))
3736
{
38-
var owner = this.GetOwnerOrThrow<ComputeApiBuilder>();
37+
var owner = this.GetOwnerOrThrow<ComputeApi>();
3938
return owner.GetImageMetadataAsync<ImageMetadata>(Id, cancellationToken);
4039
}
4140

42-
/// <inheritdoc cref="ComputeApiBuilder.GetImageMetadataItemAsync" />
41+
/// <inheritdoc cref="ComputeApi.GetImageMetadataItemAsync" />
4342
/// <exception cref="InvalidOperationException">When the <see cref="ImageReference"/> instance was not constructed by the <see cref="ComputeService"/>, as it is missing the appropriate internal state to execute service calls.</exception>
4443
public Task<string> GetMetadataItemAsync(string key, CancellationToken cancellationToken = default(CancellationToken))
4544
{
46-
var owner = this.GetOwnerOrThrow<ComputeApiBuilder>();
45+
var owner = this.GetOwnerOrThrow<ComputeApi>();
4746
return owner.GetImageMetadataItemAsync(Id, key, cancellationToken);
4847
}
4948

50-
/// <inheritdoc cref="ComputeApiBuilder.DeleteImageAsync" />
49+
/// <inheritdoc cref="ComputeApi.DeleteImageAsync" />
5150
/// <exception cref="InvalidOperationException">When the <see cref="Server"/> instance was not constructed by the <see cref="ComputeService"/>, as it is missing the appropriate internal state to execute service calls.</exception>
5251
public virtual async Task DeleteAsync(CancellationToken cancellationToken = default(CancellationToken))
5352
{
54-
var owner = this.GetOwnerOrThrow<ComputeApiBuilder>();
53+
var owner = this.GetOwnerOrThrow<ComputeApi>();
5554
await owner.DeleteImageAsync(Id, cancellationToken);
5655
}
5756

58-
/// <inheritdoc cref="ComputeApiBuilder.WaitUntilImageIsDeletedAsync{TImage,TStatus}" />
57+
/// <inheritdoc cref="ComputeApi.WaitUntilImageIsDeletedAsync{TImage,TStatus}" />
5958
/// <exception cref="InvalidOperationException">When this instance was not constructed by the <see cref="ComputeService"/>, as it is missing the appropriate internal state to execute service calls.</exception>
6059
public virtual async Task WaitUntilDeletedAsync(TimeSpan? refreshDelay = null, TimeSpan? timeout = null, IProgress<bool> progress = null, CancellationToken cancellationToken = default(CancellationToken))
6160
{
62-
var owner = this.GetOwnerOrThrow<ComputeApiBuilder>();
61+
var owner = this.GetOwnerOrThrow<ComputeApi>();
6362
await owner.WaitUntilImageIsDeletedAsync<Image, ImageStatus>(Id, null, refreshDelay, timeout, progress, cancellationToken).ConfigureAwait(false);
6463
}
6564
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
using Newtonsoft.Json;
2+
3+
namespace OpenStack.Compute.v2_1
4+
{
5+
/// <summary />
6+
public class ImageSummary : ImageReference
7+
{
8+
/// <summary />
9+
[JsonProperty("name")]
10+
public string Name { get; set; }
11+
12+
}
13+
}
Lines changed: 6 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,17 @@
1-
using System.Collections.Generic;
2-
using System.Threading;
3-
using System.Threading.Tasks;
1+
using System;
42
using Newtonsoft.Json;
5-
using Newtonsoft.Json.Linq;
6-
using OpenStack.Compute.v2_1.Serialization;
7-
using OpenStack.Serialization;
83

94
namespace OpenStack.Compute.v2_1
105
{
116
/// <summary />
12-
[JsonConverter(typeof(KeyPairConverter))]
13-
public class KeyPair : IHaveExtraData, IServiceResource
7+
public class KeyPair : KeyPairSummary
148
{
159
/// <summary />
16-
[JsonProperty("name")]
17-
public string Name { get; set; }
10+
[JsonProperty("id")]
11+
public Identifier Id { get; set; }
1812

1913
/// <summary />
20-
[JsonProperty("public_key")]
21-
public string PublicKey { get; set; }
22-
23-
/// <summary />
24-
[JsonProperty("fingerprint")]
25-
public string Fingerprint { get; set; }
26-
27-
/// <summary />
28-
[JsonExtensionData]
29-
IDictionary<string, JToken> IHaveExtraData.Data { get; set; } = new Dictionary<string, JToken>();
30-
31-
object IServiceResource.Owner { get; set; }
32-
33-
/// <inheritdoc cref="ComputeApiBuilder.DeleteKeyPairAsync" />
34-
public Task DeleteAsync(CancellationToken cancellationToken = default(CancellationToken))
35-
{
36-
var compute = this.GetOwnerOrThrow<ComputeApiBuilder>();
37-
return compute.DeleteKeyPairAsync(Name, cancellationToken);
38-
}
14+
[JsonProperty("created_at")]
15+
public DateTimeOffset Created { get; set; }
3916
}
4017
}

0 commit comments

Comments
 (0)