Skip to content

Commit 068fa9e

Browse files
authored
feedback from arch board review (Azure#22766)
* feedback from arch board review * update api * move to lowercase folder * remove unused recordings
1 parent 10b1a67 commit 068fa9e

File tree

75 files changed

+1398
-1231
lines changed

Some content is hidden

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

75 files changed

+1398
-1231
lines changed

sdk/resourcemanager/Azure.ResourceManager.Core/README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -147,10 +147,10 @@ AvailabilitySetOperations availabilitySetOperations = armClient.GetAvailabilityS
147147
AvailabilitySet availabilitySet = await availabilitySetOperations.GetAsync();
148148
```
149149

150-
### `tryGet` and `doesExists` convenience methods
151-
If you are not sure if a resource you want to get exists, or you just want to check if it exists, you can use `tryGet()` or `doesExists()` methods, which can be invoque from any [Resource]Container class.
150+
### `tryGet` and `CheckIfExistss` convenience methods
151+
If you are not sure if a resource you want to get exists, or you just want to check if it exists, you can use `tryGet()` or `CheckIfExistss()` methods, which can be invoque from any [Resource]Container class.
152152

153-
`tryGet()` and `tryGetAsync()` are going to return a null object if the specified resource name or id does not exists. On the other hand, `doesExists()` and `doesExistsAsync()` is going to return a boolean, depending if the specified resource exists.
153+
`tryGet()` and `tryGetAsync()` are going to return a null object if the specified resource name or id does not exists. On the other hand, `CheckIfExistss()` and `CheckIfExistssAsync()` is going to return a boolean, depending if the specified resource exists.
154154

155155
You can find an example for these methods [below](#check-if-resource-group-exists).
156156

@@ -205,12 +205,12 @@ await resourceGroup.DeleteAsync();
205205
```
206206

207207
### Check if Resource Group exists
208-
```C# Snippet:Readme_DoesExistsRG
208+
```C# Snippet:Readme_CheckIfExistssRG
209209
var armClient = new ArmClient(new DefaultAzureCredential());
210210
Subscription subscription = armClient.DefaultSubscription;
211211
string rgName = "myRgName";
212212

213-
var exists = await subscription.GetResourceGroups().DoesExistAsync(rgName);
213+
var exists = await subscription.GetResourceGroups().CheckIfExistsAsync(rgName);
214214

215215
if (exists)
216216
{

sdk/resourcemanager/Azure.ResourceManager.Core/api/Azure.ResourceManager.Core.netstandard2.0.cs

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

sdk/resourcemanager/Azure.ResourceManager.Core/src/ArmClient.cs

Lines changed: 38 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,23 @@ protected ArmClient()
3030
{
3131
}
3232

33+
/// <summary>
34+
/// Initializes a new instance of the <see cref="ArmClient"/> class.
35+
/// </summary>
36+
/// <param name="credential"> A credential used to authenticate to an Azure Service. </param>
37+
/// <exception cref="ArgumentNullException"> If <see cref="TokenCredential"/> is null. </exception>
38+
public ArmClient(TokenCredential credential)
39+
: this(null, new Uri(DefaultUri), credential, null)
40+
{
41+
}
42+
3343
/// <summary>
3444
/// Initializes a new instance of the <see cref="ArmClient"/> class.
3545
/// </summary>
3646
/// <param name="credential"> A credential used to authenticate to an Azure Service. </param>
3747
/// <param name="options"> The client parameters to use in these operations. </param>
3848
/// <exception cref="ArgumentNullException"> If <see cref="TokenCredential"/> is null. </exception>
39-
public ArmClient(TokenCredential credential, ArmClientOptions options = default)
49+
public ArmClient(TokenCredential credential, ArmClientOptions options)
4050
: this(null, new Uri(DefaultUri), credential, options)
4151
{
4252
}
@@ -158,30 +168,46 @@ private Subscription GetDefaultSubscription()
158168
}
159169

160170
/// <summary>
161-
/// Creates a container using the lambda expression passed in.
171+
/// Provides a way to reuse the protected client context.
162172
/// </summary>
163-
/// <typeparam name="T"> The type of container to construct. </typeparam>
164-
/// <param name="func"> The lambda expression to execute. </param>
165-
/// <returns> The container type requested. </returns>
173+
/// <typeparam name="T"> The actual type returned by the delegate. </typeparam>
174+
/// <param name="func"> The method to pass the internal properties to. </param>
175+
/// <returns> Whatever the delegate returns. </returns>
166176
[EditorBrowsable(EditorBrowsableState.Never)]
167-
public T GetContainer<T>(Func<ArmClientOptions, TokenCredential, Uri, HttpPipeline, T> func)
177+
[ForwardsClientCalls]
178+
public virtual T UseClientContext<T>(Func<Uri, TokenCredential, ArmClientOptions, HttpPipeline, T> func)
168179
{
169-
return func(ClientOptions, Credential, BaseUri, Pipeline);
180+
return func(BaseUri, Credential, ClientOptions, Pipeline);
170181
}
171182

172183
/// <summary>
173184
/// Get the operations for a list of specific resources.
174185
/// </summary>
175186
/// <param name="ids"> A list of the IDs of the resources to retrieve. </param>
176187
/// <returns> The list of operations that can be performed over the GenericResources. </returns>
177-
public virtual IList<GenericResourceOperations> GetGenericResourceOperations(IEnumerable<string> ids)
188+
public virtual IReadOnlyList<GenericResourceOperations> GetGenericResourceOperations(params string[] ids)
189+
{
190+
return GetGenericResourceOperationsInternal(ids);
191+
}
192+
193+
/// <summary>
194+
/// Get the operations for a list of specific resources.
195+
/// </summary>
196+
/// <param name="ids"> A list of the IDs of the resources to retrieve. </param>
197+
/// <returns> The list of operations that can be performed over the GenericResources. </returns>
198+
public virtual IReadOnlyList<GenericResourceOperations> GetGenericResourceOperations(IEnumerable<string> ids)
199+
{
200+
return GetGenericResourceOperationsInternal(ids);
201+
}
202+
203+
private IReadOnlyList<GenericResourceOperations> GetGenericResourceOperationsInternal(IEnumerable<string> ids)
178204
{
179205
if (ids == null)
180206
{
181207
throw new ArgumentNullException(nameof(ids));
182208
}
183209

184-
IList<GenericResourceOperations> genericRespirceOperations = new List<GenericResourceOperations>();
210+
var genericRespirceOperations = new ChangeTrackingList<GenericResourceOperations>();
185211
foreach (string id in ids)
186212
{
187213
genericRespirceOperations.Add(new GenericResourceOperations(DefaultSubscription, id));
@@ -207,11 +233,11 @@ public virtual GenericResourceOperations GetGenericResourceOperations(string id)
207233
/// <summary>
208234
/// Gets the RestApi definition for a given Azure namespace.
209235
/// </summary>
210-
/// <param name="nameSpace"> The namespace to get the rest API for. </param>
236+
/// <param name="azureNamespace"> The namespace to get the rest API for. </param>
211237
/// <returns> A container representing the rest apis for the namespace. </returns>
212-
public virtual RestApiContainer GetRestApis(string nameSpace)
238+
public virtual RestApiContainer GetRestApis(string azureNamespace)
213239
{
214-
return new RestApiContainer(new ClientContext(ClientOptions, Credential, BaseUri, Pipeline), nameSpace);
240+
return new RestApiContainer(new ClientContext(ClientOptions, Credential, BaseUri, Pipeline), azureNamespace);
215241
}
216242

217243
/// <summary> Gets all resource providers for a subscription. </summary>
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66

77
namespace Azure.ResourceManager.Core
88
{
9-
public partial class PreDefinedTagCount
9+
public partial class PredefinedTagCount
1010
{
11-
internal static PreDefinedTagCount DeserializeTagCount(JsonElement element)
11+
internal static PredefinedTagCount DeserializeTagCount(JsonElement element)
1212
{
1313
Optional<string> type = default;
1414
Optional<int> value = default;
@@ -30,7 +30,7 @@ internal static PreDefinedTagCount DeserializeTagCount(JsonElement element)
3030
continue;
3131
}
3232
}
33-
return new PreDefinedTagCount(type.Value, Optional.ToNullable(value));
33+
return new PredefinedTagCount(type.Value, Optional.ToNullable(value));
3434
}
3535
}
3636
}
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,17 @@
44
namespace Azure.ResourceManager.Core
55
{
66
/// <summary> Tag count. </summary>
7-
public partial class PreDefinedTagCount
7+
public partial class PredefinedTagCount
88
{
99
/// <summary> Initializes a new instance of TagCount. </summary>
10-
internal PreDefinedTagCount()
10+
internal PredefinedTagCount()
1111
{
1212
}
1313

1414
/// <summary> Initializes a new instance of TagCount. </summary>
1515
/// <param name="type"> Type of count. </param>
1616
/// <param name="value"> Value of count. </param>
17-
internal PreDefinedTagCount(string type, int? value)
17+
internal PredefinedTagCount(string type, int? value)
1818
{
1919
Type = type;
2020
Value = value;
Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@
77

88
namespace Azure.ResourceManager.Core
99
{
10-
public partial class PreDefinedTagData
10+
public partial class PredefinedTagData
1111
{
12-
internal static PreDefinedTagData DeserializeTagDetails(JsonElement element)
12+
internal static PredefinedTagData DeserializeTagDetails(JsonElement element)
1313
{
1414
Optional<string> id = default;
1515
Optional<string> tagName = default;
16-
Optional<PreDefinedTagCount> count = default;
17-
Optional<IReadOnlyList<PreDefinedTagValue>> values = default;
16+
Optional<PredefinedTagCount> count = default;
17+
Optional<IReadOnlyList<PredefinedTagValue>> values = default;
1818
foreach (var property in element.EnumerateObject())
1919
{
2020
if (property.NameEquals("id"))
@@ -34,7 +34,7 @@ internal static PreDefinedTagData DeserializeTagDetails(JsonElement element)
3434
property.ThrowNonNullablePropertyIsNull();
3535
continue;
3636
}
37-
count = PreDefinedTagCount.DeserializeTagCount(property.Value);
37+
count = PredefinedTagCount.DeserializeTagCount(property.Value);
3838
continue;
3939
}
4040
if (property.NameEquals("values"))
@@ -44,16 +44,16 @@ internal static PreDefinedTagData DeserializeTagDetails(JsonElement element)
4444
property.ThrowNonNullablePropertyIsNull();
4545
continue;
4646
}
47-
List<PreDefinedTagValue> array = new List<PreDefinedTagValue>();
47+
List<PredefinedTagValue> array = new List<PredefinedTagValue>();
4848
foreach (var item in property.Value.EnumerateArray())
4949
{
50-
array.Add(PreDefinedTagValue.DeserializeTagValue(item));
50+
array.Add(PredefinedTagValue.DeserializeTagValue(item));
5151
}
5252
values = array;
5353
continue;
5454
}
5555
}
56-
return new PreDefinedTagData(id.Value, tagName.Value, count.Value, Optional.ToList(values));
56+
return new PredefinedTagData(id.Value, tagName.Value, count.Value, Optional.ToList(values));
5757
}
5858
}
5959
}
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,20 @@
77
namespace Azure.ResourceManager.Core
88
{
99
/// <summary> Tag details. </summary>
10-
public partial class PreDefinedTagData : SubResource
10+
public partial class PredefinedTagData : SubResource
1111
{
1212
/// <summary> Initializes a new instance of TagDetails. </summary>
13-
internal PreDefinedTagData()
13+
internal PredefinedTagData()
1414
{
15-
Values = new ChangeTrackingList<PreDefinedTagValue>();
15+
Values = new ChangeTrackingList<PredefinedTagValue>();
1616
}
1717

1818
/// <summary> Initializes a new instance of TagDetails. </summary>
1919
/// <param name="id"> The tag name ID. </param>
2020
/// <param name="tagName"> The tag name. </param>
2121
/// <param name="count"> The total number of resources that use the resource tag. When a tag is initially created and has no associated resources, the value is 0. </param>
2222
/// <param name="values"> The list of tag values. </param>
23-
internal PreDefinedTagData(string id, string tagName, PreDefinedTagCount count, IReadOnlyList<PreDefinedTagValue> values) : base(id)
23+
internal PredefinedTagData(string id, string tagName, PredefinedTagCount count, IReadOnlyList<PredefinedTagValue> values) : base(id)
2424
{
2525
TagName = tagName;
2626
Count = count;
@@ -30,8 +30,8 @@ internal PreDefinedTagData(string id, string tagName, PreDefinedTagCount count,
3030
/// <summary> The tag name. </summary>
3131
public string TagName { get; }
3232
/// <summary> The total number of resources that use the resource tag. When a tag is initially created and has no associated resources, the value is 0. </summary>
33-
public PreDefinedTagCount Count { get; }
33+
public PredefinedTagCount Count { get; }
3434
/// <summary> The list of tag values. </summary>
35-
public IReadOnlyList<PreDefinedTagValue> Values { get; }
35+
public IReadOnlyList<PredefinedTagValue> Values { get; }
3636
}
3737
}
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66

77
namespace Azure.ResourceManager.Core
88
{
9-
public partial class PreDefinedTagValue
9+
public partial class PredefinedTagValue
1010
{
11-
internal static PreDefinedTagValue DeserializeTagValue(JsonElement element)
11+
internal static PredefinedTagValue DeserializeTagValue(JsonElement element)
1212
{
1313
Optional<string> id = default;
1414
Optional<string> tagValue = default;
15-
Optional<PreDefinedTagCount> count = default;
15+
Optional<PredefinedTagCount> count = default;
1616
foreach (var property in element.EnumerateObject())
1717
{
1818
if (property.NameEquals("id"))
@@ -32,11 +32,11 @@ internal static PreDefinedTagValue DeserializeTagValue(JsonElement element)
3232
property.ThrowNonNullablePropertyIsNull();
3333
continue;
3434
}
35-
count = PreDefinedTagCount.DeserializeTagCount(property.Value);
35+
count = PredefinedTagCount.DeserializeTagCount(property.Value);
3636
continue;
3737
}
3838
}
39-
return new PreDefinedTagValue(id.Value, tagValue.Value, count.Value);
39+
return new PredefinedTagValue(id.Value, tagValue.Value, count.Value);
4040
}
4141
}
4242
}
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,18 @@
44
namespace Azure.ResourceManager.Core
55
{
66
/// <summary> Tag information. </summary>
7-
public partial class PreDefinedTagValue
7+
public partial class PredefinedTagValue
88
{
99
/// <summary> Initializes a new instance of TagValue. </summary>
10-
internal PreDefinedTagValue()
10+
internal PredefinedTagValue()
1111
{
1212
}
1313

1414
/// <summary> Initializes a new instance of TagValue. </summary>
1515
/// <param name="id"> The tag value ID. </param>
1616
/// <param name="tagValueValue"> The tag value. </param>
1717
/// <param name="count"> The tag value count. </param>
18-
internal PreDefinedTagValue(string id, string tagValueValue, PreDefinedTagCount count)
18+
internal PredefinedTagValue(string id, string tagValueValue, PredefinedTagCount count)
1919
{
2020
Id = id;
2121
TagValueValue = tagValueValue;
@@ -27,6 +27,6 @@ internal PreDefinedTagValue(string id, string tagValueValue, PreDefinedTagCount
2727
/// <summary> The tag value. </summary>
2828
public string TagValueValue { get; }
2929
/// <summary> The tag value count. </summary>
30-
public PreDefinedTagCount Count { get; }
30+
public PredefinedTagCount Count { get; }
3131
}
3232
}
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@
77

88
namespace Azure.ResourceManager.Core
99
{
10-
internal partial class PreDefinedTagsListResult
10+
internal partial class PredefinedTagsListResult
1111
{
12-
internal static PreDefinedTagsListResult DeserializeTagsListResult(JsonElement element)
12+
internal static PredefinedTagsListResult DeserializeTagsListResult(JsonElement element)
1313
{
14-
Optional<IReadOnlyList<PreDefinedTagData>> value = default;
14+
Optional<IReadOnlyList<PredefinedTagData>> value = default;
1515
Optional<string> nextLink = default;
1616
foreach (var property in element.EnumerateObject())
1717
{
@@ -22,10 +22,10 @@ internal static PreDefinedTagsListResult DeserializeTagsListResult(JsonElement e
2222
property.ThrowNonNullablePropertyIsNull();
2323
continue;
2424
}
25-
List<PreDefinedTagData> array = new List<PreDefinedTagData>();
25+
List<PredefinedTagData> array = new List<PredefinedTagData>();
2626
foreach (var item in property.Value.EnumerateArray())
2727
{
28-
array.Add(PreDefinedTagData.DeserializeTagDetails(item));
28+
array.Add(PredefinedTagData.DeserializeTagDetails(item));
2929
}
3030
value = array;
3131
continue;
@@ -36,7 +36,7 @@ internal static PreDefinedTagsListResult DeserializeTagsListResult(JsonElement e
3636
continue;
3737
}
3838
}
39-
return new PreDefinedTagsListResult(Optional.ToList(value), nextLink.Value);
39+
return new PredefinedTagsListResult(Optional.ToList(value), nextLink.Value);
4040
}
4141
}
4242
}

0 commit comments

Comments
 (0)