-
Notifications
You must be signed in to change notification settings - Fork 4.5k
/
IotFirmwareDefenseExtensions.cs
283 lines (261 loc) · 15.4 KB
/
IotFirmwareDefenseExtensions.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// <auto-generated/>
#nullable disable
using System;
using System.Threading;
using System.Threading.Tasks;
using Azure;
using Azure.Core;
using Azure.ResourceManager;
using Azure.ResourceManager.IotFirmwareDefense.Mocking;
using Azure.ResourceManager.Resources;
namespace Azure.ResourceManager.IotFirmwareDefense
{
/// <summary> A class to add extension methods to Azure.ResourceManager.IotFirmwareDefense. </summary>
public static partial class IotFirmwareDefenseExtensions
{
private static MockableIotFirmwareDefenseArmClient GetMockableIotFirmwareDefenseArmClient(ArmClient client)
{
return client.GetCachedClient(client0 => new MockableIotFirmwareDefenseArmClient(client0));
}
private static MockableIotFirmwareDefenseResourceGroupResource GetMockableIotFirmwareDefenseResourceGroupResource(ArmResource resource)
{
return resource.GetCachedClient(client => new MockableIotFirmwareDefenseResourceGroupResource(client, resource.Id));
}
private static MockableIotFirmwareDefenseSubscriptionResource GetMockableIotFirmwareDefenseSubscriptionResource(ArmResource resource)
{
return resource.GetCachedClient(client => new MockableIotFirmwareDefenseSubscriptionResource(client, resource.Id));
}
/// <summary>
/// Gets an object representing an <see cref="IotFirmwareResource" /> along with the instance operations that can be performed on it but with no data.
/// You can use <see cref="IotFirmwareResource.CreateResourceIdentifier" /> to create an <see cref="IotFirmwareResource" /> <see cref="ResourceIdentifier" /> from its components.
/// <item>
/// <term>Mocking</term>
/// <description>To mock this method, please mock <see cref="MockableIotFirmwareDefenseArmClient.GetIotFirmwareResource(ResourceIdentifier)"/> instead.</description>
/// </item>
/// </summary>
/// <param name="client"> The <see cref="ArmClient" /> instance the method will execute against. </param>
/// <param name="id"> The resource ID of the resource to get. </param>
/// <exception cref="ArgumentNullException"> <paramref name="client"/> is null. </exception>
/// <returns> Returns a <see cref="IotFirmwareResource"/> object. </returns>
public static IotFirmwareResource GetIotFirmwareResource(this ArmClient client, ResourceIdentifier id)
{
if (client == null)
{
throw new ArgumentNullException(nameof(client));
}
return GetMockableIotFirmwareDefenseArmClient(client).GetIotFirmwareResource(id);
}
/// <summary>
/// Gets an object representing a <see cref="FirmwareAnalysisSummaryResource" /> along with the instance operations that can be performed on it but with no data.
/// You can use <see cref="FirmwareAnalysisSummaryResource.CreateResourceIdentifier" /> to create a <see cref="FirmwareAnalysisSummaryResource" /> <see cref="ResourceIdentifier" /> from its components.
/// <item>
/// <term>Mocking</term>
/// <description>To mock this method, please mock <see cref="MockableIotFirmwareDefenseArmClient.GetFirmwareAnalysisSummaryResource(ResourceIdentifier)"/> instead.</description>
/// </item>
/// </summary>
/// <param name="client"> The <see cref="ArmClient" /> instance the method will execute against. </param>
/// <param name="id"> The resource ID of the resource to get. </param>
/// <exception cref="ArgumentNullException"> <paramref name="client"/> is null. </exception>
/// <returns> Returns a <see cref="FirmwareAnalysisSummaryResource"/> object. </returns>
public static FirmwareAnalysisSummaryResource GetFirmwareAnalysisSummaryResource(this ArmClient client, ResourceIdentifier id)
{
if (client == null)
{
throw new ArgumentNullException(nameof(client));
}
return GetMockableIotFirmwareDefenseArmClient(client).GetFirmwareAnalysisSummaryResource(id);
}
/// <summary>
/// Gets an object representing a <see cref="FirmwareAnalysisWorkspaceResource" /> along with the instance operations that can be performed on it but with no data.
/// You can use <see cref="FirmwareAnalysisWorkspaceResource.CreateResourceIdentifier" /> to create a <see cref="FirmwareAnalysisWorkspaceResource" /> <see cref="ResourceIdentifier" /> from its components.
/// <item>
/// <term>Mocking</term>
/// <description>To mock this method, please mock <see cref="MockableIotFirmwareDefenseArmClient.GetFirmwareAnalysisWorkspaceResource(ResourceIdentifier)"/> instead.</description>
/// </item>
/// </summary>
/// <param name="client"> The <see cref="ArmClient" /> instance the method will execute against. </param>
/// <param name="id"> The resource ID of the resource to get. </param>
/// <exception cref="ArgumentNullException"> <paramref name="client"/> is null. </exception>
/// <returns> Returns a <see cref="FirmwareAnalysisWorkspaceResource"/> object. </returns>
public static FirmwareAnalysisWorkspaceResource GetFirmwareAnalysisWorkspaceResource(this ArmClient client, ResourceIdentifier id)
{
if (client == null)
{
throw new ArgumentNullException(nameof(client));
}
return GetMockableIotFirmwareDefenseArmClient(client).GetFirmwareAnalysisWorkspaceResource(id);
}
/// <summary>
/// Gets a collection of FirmwareAnalysisWorkspaceResources in the ResourceGroupResource.
/// <item>
/// <term>Mocking</term>
/// <description>To mock this method, please mock <see cref="MockableIotFirmwareDefenseResourceGroupResource.GetFirmwareAnalysisWorkspaces()"/> instead.</description>
/// </item>
/// </summary>
/// <param name="resourceGroupResource"> The <see cref="ResourceGroupResource" /> instance the method will execute against. </param>
/// <exception cref="ArgumentNullException"> <paramref name="resourceGroupResource"/> is null. </exception>
/// <returns> An object representing collection of FirmwareAnalysisWorkspaceResources and their operations over a FirmwareAnalysisWorkspaceResource. </returns>
public static FirmwareAnalysisWorkspaceCollection GetFirmwareAnalysisWorkspaces(this ResourceGroupResource resourceGroupResource)
{
if (resourceGroupResource == null)
{
throw new ArgumentNullException(nameof(resourceGroupResource));
}
return GetMockableIotFirmwareDefenseResourceGroupResource(resourceGroupResource).GetFirmwareAnalysisWorkspaces();
}
/// <summary>
/// Get firmware analysis workspace.
/// <list type="bullet">
/// <item>
/// <term>Request Path</term>
/// <description>/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTFirmwareDefense/workspaces/{workspaceName}</description>
/// </item>
/// <item>
/// <term>Operation Id</term>
/// <description>Workspaces_Get</description>
/// </item>
/// <item>
/// <term>Default Api Version</term>
/// <description>2024-01-10</description>
/// </item>
/// <item>
/// <term>Resource</term>
/// <description><see cref="FirmwareAnalysisWorkspaceResource"/></description>
/// </item>
/// </list>
/// <item>
/// <term>Mocking</term>
/// <description>To mock this method, please mock <see cref="MockableIotFirmwareDefenseResourceGroupResource.GetFirmwareAnalysisWorkspaceAsync(string,CancellationToken)"/> instead.</description>
/// </item>
/// </summary>
/// <param name="resourceGroupResource"> The <see cref="ResourceGroupResource" /> instance the method will execute against. </param>
/// <param name="workspaceName"> The name of the firmware analysis workspace. </param>
/// <param name="cancellationToken"> The cancellation token to use. </param>
/// <exception cref="ArgumentNullException"> <paramref name="resourceGroupResource"/> or <paramref name="workspaceName"/> is null. </exception>
/// <exception cref="ArgumentException"> <paramref name="workspaceName"/> is an empty string, and was expected to be non-empty. </exception>
[ForwardsClientCalls]
public static async Task<Response<FirmwareAnalysisWorkspaceResource>> GetFirmwareAnalysisWorkspaceAsync(this ResourceGroupResource resourceGroupResource, string workspaceName, CancellationToken cancellationToken = default)
{
if (resourceGroupResource == null)
{
throw new ArgumentNullException(nameof(resourceGroupResource));
}
return await GetMockableIotFirmwareDefenseResourceGroupResource(resourceGroupResource).GetFirmwareAnalysisWorkspaceAsync(workspaceName, cancellationToken).ConfigureAwait(false);
}
/// <summary>
/// Get firmware analysis workspace.
/// <list type="bullet">
/// <item>
/// <term>Request Path</term>
/// <description>/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTFirmwareDefense/workspaces/{workspaceName}</description>
/// </item>
/// <item>
/// <term>Operation Id</term>
/// <description>Workspaces_Get</description>
/// </item>
/// <item>
/// <term>Default Api Version</term>
/// <description>2024-01-10</description>
/// </item>
/// <item>
/// <term>Resource</term>
/// <description><see cref="FirmwareAnalysisWorkspaceResource"/></description>
/// </item>
/// </list>
/// <item>
/// <term>Mocking</term>
/// <description>To mock this method, please mock <see cref="MockableIotFirmwareDefenseResourceGroupResource.GetFirmwareAnalysisWorkspace(string,CancellationToken)"/> instead.</description>
/// </item>
/// </summary>
/// <param name="resourceGroupResource"> The <see cref="ResourceGroupResource" /> instance the method will execute against. </param>
/// <param name="workspaceName"> The name of the firmware analysis workspace. </param>
/// <param name="cancellationToken"> The cancellation token to use. </param>
/// <exception cref="ArgumentNullException"> <paramref name="resourceGroupResource"/> or <paramref name="workspaceName"/> is null. </exception>
/// <exception cref="ArgumentException"> <paramref name="workspaceName"/> is an empty string, and was expected to be non-empty. </exception>
[ForwardsClientCalls]
public static Response<FirmwareAnalysisWorkspaceResource> GetFirmwareAnalysisWorkspace(this ResourceGroupResource resourceGroupResource, string workspaceName, CancellationToken cancellationToken = default)
{
if (resourceGroupResource == null)
{
throw new ArgumentNullException(nameof(resourceGroupResource));
}
return GetMockableIotFirmwareDefenseResourceGroupResource(resourceGroupResource).GetFirmwareAnalysisWorkspace(workspaceName, cancellationToken);
}
/// <summary>
/// Lists all of the firmware analysis workspaces in the specified subscription.
/// <list type="bullet">
/// <item>
/// <term>Request Path</term>
/// <description>/subscriptions/{subscriptionId}/providers/Microsoft.IoTFirmwareDefense/workspaces</description>
/// </item>
/// <item>
/// <term>Operation Id</term>
/// <description>Workspaces_ListBySubscription</description>
/// </item>
/// <item>
/// <term>Default Api Version</term>
/// <description>2024-01-10</description>
/// </item>
/// <item>
/// <term>Resource</term>
/// <description><see cref="FirmwareAnalysisWorkspaceResource"/></description>
/// </item>
/// </list>
/// <item>
/// <term>Mocking</term>
/// <description>To mock this method, please mock <see cref="MockableIotFirmwareDefenseSubscriptionResource.GetFirmwareAnalysisWorkspaces(CancellationToken)"/> instead.</description>
/// </item>
/// </summary>
/// <param name="subscriptionResource"> The <see cref="SubscriptionResource" /> instance the method will execute against. </param>
/// <param name="cancellationToken"> The cancellation token to use. </param>
/// <exception cref="ArgumentNullException"> <paramref name="subscriptionResource"/> is null. </exception>
/// <returns> An async collection of <see cref="FirmwareAnalysisWorkspaceResource"/> that may take multiple service requests to iterate over. </returns>
public static AsyncPageable<FirmwareAnalysisWorkspaceResource> GetFirmwareAnalysisWorkspacesAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default)
{
if (subscriptionResource == null)
{
throw new ArgumentNullException(nameof(subscriptionResource));
}
return GetMockableIotFirmwareDefenseSubscriptionResource(subscriptionResource).GetFirmwareAnalysisWorkspacesAsync(cancellationToken);
}
/// <summary>
/// Lists all of the firmware analysis workspaces in the specified subscription.
/// <list type="bullet">
/// <item>
/// <term>Request Path</term>
/// <description>/subscriptions/{subscriptionId}/providers/Microsoft.IoTFirmwareDefense/workspaces</description>
/// </item>
/// <item>
/// <term>Operation Id</term>
/// <description>Workspaces_ListBySubscription</description>
/// </item>
/// <item>
/// <term>Default Api Version</term>
/// <description>2024-01-10</description>
/// </item>
/// <item>
/// <term>Resource</term>
/// <description><see cref="FirmwareAnalysisWorkspaceResource"/></description>
/// </item>
/// </list>
/// <item>
/// <term>Mocking</term>
/// <description>To mock this method, please mock <see cref="MockableIotFirmwareDefenseSubscriptionResource.GetFirmwareAnalysisWorkspaces(CancellationToken)"/> instead.</description>
/// </item>
/// </summary>
/// <param name="subscriptionResource"> The <see cref="SubscriptionResource" /> instance the method will execute against. </param>
/// <param name="cancellationToken"> The cancellation token to use. </param>
/// <exception cref="ArgumentNullException"> <paramref name="subscriptionResource"/> is null. </exception>
/// <returns> A collection of <see cref="FirmwareAnalysisWorkspaceResource"/> that may take multiple service requests to iterate over. </returns>
public static Pageable<FirmwareAnalysisWorkspaceResource> GetFirmwareAnalysisWorkspaces(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default)
{
if (subscriptionResource == null)
{
throw new ArgumentNullException(nameof(subscriptionResource));
}
return GetMockableIotFirmwareDefenseSubscriptionResource(subscriptionResource).GetFirmwareAnalysisWorkspaces(cancellationToken);
}
}
}