|  |  | 1 |  | // Copyright (c) Microsoft Corporation. All rights reserved. | 
|  |  | 2 |  | // Licensed under the MIT License. | 
|  |  | 3 |  |  | 
|  |  | 4 |  | // <auto-generated/> | 
|  |  | 5 |  |  | 
|  |  | 6 |  | #nullable disable | 
|  |  | 7 |  |  | 
|  |  | 8 |  | using System; | 
|  |  | 9 |  | using System.Text.Json; | 
|  |  | 10 |  | using System.Threading; | 
|  |  | 11 |  | using System.Threading.Tasks; | 
|  |  | 12 |  | using Azure; | 
|  |  | 13 |  | using Azure.Core; | 
|  |  | 14 |  | using Azure.Core.Pipeline; | 
|  |  | 15 |  | using Azure.ResourceManager.Compute.Models; | 
|  |  | 16 |  |  | 
|  |  | 17 |  | namespace Azure.ResourceManager.Compute | 
|  |  | 18 |  | { | 
|  |  | 19 |  |     internal partial class VirtualMachineScaleSetExtensionsRestOperations | 
|  |  | 20 |  |     { | 
|  |  | 21 |  |         private string subscriptionId; | 
|  |  | 22 |  |         private Uri endpoint; | 
|  |  | 23 |  |         private ClientDiagnostics _clientDiagnostics; | 
|  |  | 24 |  |         private HttpPipeline _pipeline; | 
|  |  | 25 |  |  | 
|  |  | 26 |  |         /// <summary> Initializes a new instance of VirtualMachineScaleSetExtensionsRestOperations. </summary> | 
|  |  | 27 |  |         /// <param name="clientDiagnostics"> The handler for diagnostic messaging in the client. </param> | 
|  |  | 28 |  |         /// <param name="pipeline"> The HTTP pipeline for sending and receiving REST requests and responses. </param> | 
|  |  | 29 |  |         /// <param name="subscriptionId"> Subscription credentials which uniquely identify Microsoft Azure subscription. | 
|  |  | 30 |  |         /// <param name="endpoint"> server parameter. </param> | 
|  |  | 31 |  |         /// <exception cref="ArgumentNullException"> This occurs when one of the required arguments is null. </exception | 
|  | 396 | 32 |  |         public VirtualMachineScaleSetExtensionsRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline | 
|  |  | 33 |  |         { | 
|  | 396 | 34 |  |             if (subscriptionId == null) | 
|  |  | 35 |  |             { | 
|  | 0 | 36 |  |                 throw new ArgumentNullException(nameof(subscriptionId)); | 
|  |  | 37 |  |             } | 
|  | 396 | 38 |  |             endpoint ??= new Uri("https://management.azure.com"); | 
|  |  | 39 |  |  | 
|  | 396 | 40 |  |             this.subscriptionId = subscriptionId; | 
|  | 396 | 41 |  |             this.endpoint = endpoint; | 
|  | 396 | 42 |  |             _clientDiagnostics = clientDiagnostics; | 
|  | 396 | 43 |  |             _pipeline = pipeline; | 
|  | 396 | 44 |  |         } | 
|  |  | 45 |  |  | 
|  |  | 46 |  |         internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, string vmScaleSetName, string vmssExt | 
|  |  | 47 |  |         { | 
|  | 16 | 48 |  |             var message = _pipeline.CreateMessage(); | 
|  | 16 | 49 |  |             var request = message.Request; | 
|  | 16 | 50 |  |             request.Method = RequestMethod.Put; | 
|  | 16 | 51 |  |             var uri = new RawRequestUriBuilder(); | 
|  | 16 | 52 |  |             uri.Reset(endpoint); | 
|  | 16 | 53 |  |             uri.AppendPath("/subscriptions/", false); | 
|  | 16 | 54 |  |             uri.AppendPath(subscriptionId, true); | 
|  | 16 | 55 |  |             uri.AppendPath("/resourceGroups/", false); | 
|  | 16 | 56 |  |             uri.AppendPath(resourceGroupName, true); | 
|  | 16 | 57 |  |             uri.AppendPath("/providers/Microsoft.Compute/virtualMachineScaleSets/", false); | 
|  | 16 | 58 |  |             uri.AppendPath(vmScaleSetName, true); | 
|  | 16 | 59 |  |             uri.AppendPath("/extensions/", false); | 
|  | 16 | 60 |  |             uri.AppendPath(vmssExtensionName, true); | 
|  | 16 | 61 |  |             uri.AppendQuery("api-version", "2019-12-01", true); | 
|  | 16 | 62 |  |             request.Uri = uri; | 
|  | 16 | 63 |  |             request.Headers.Add("Content-Type", "application/json"); | 
|  | 16 | 64 |  |             var content = new Utf8JsonRequestContent(); | 
|  | 16 | 65 |  |             content.JsonWriter.WriteObjectValue(extensionParameters); | 
|  | 16 | 66 |  |             request.Content = content; | 
|  | 16 | 67 |  |             return message; | 
|  |  | 68 |  |         } | 
|  |  | 69 |  |  | 
|  |  | 70 |  |         /// <summary> The operation to create or update an extension. </summary> | 
|  |  | 71 |  |         /// <param name="resourceGroupName"> The name of the resource group. </param> | 
|  |  | 72 |  |         /// <param name="vmScaleSetName"> The name of the VM scale set where the extension should be create or updated.  | 
|  |  | 73 |  |         /// <param name="vmssExtensionName"> The name of the VM scale set extension. </param> | 
|  |  | 74 |  |         /// <param name="extensionParameters"> Parameters supplied to the Create VM scale set Extension operation. </par | 
|  |  | 75 |  |         /// <param name="cancellationToken"> The cancellation token to use. </param> | 
|  |  | 76 |  |         public async Task<Response> CreateOrUpdateAsync(string resourceGroupName, string vmScaleSetName, string vmssExte | 
|  |  | 77 |  |         { | 
|  | 4 | 78 |  |             if (resourceGroupName == null) | 
|  |  | 79 |  |             { | 
|  | 0 | 80 |  |                 throw new ArgumentNullException(nameof(resourceGroupName)); | 
|  |  | 81 |  |             } | 
|  | 4 | 82 |  |             if (vmScaleSetName == null) | 
|  |  | 83 |  |             { | 
|  | 0 | 84 |  |                 throw new ArgumentNullException(nameof(vmScaleSetName)); | 
|  |  | 85 |  |             } | 
|  | 4 | 86 |  |             if (vmssExtensionName == null) | 
|  |  | 87 |  |             { | 
|  | 0 | 88 |  |                 throw new ArgumentNullException(nameof(vmssExtensionName)); | 
|  |  | 89 |  |             } | 
|  | 4 | 90 |  |             if (extensionParameters == null) | 
|  |  | 91 |  |             { | 
|  | 0 | 92 |  |                 throw new ArgumentNullException(nameof(extensionParameters)); | 
|  |  | 93 |  |             } | 
|  |  | 94 |  |  | 
|  | 4 | 95 |  |             using var message = CreateCreateOrUpdateRequest(resourceGroupName, vmScaleSetName, vmssExtensionName, extens | 
|  | 4 | 96 |  |             await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); | 
|  | 4 | 97 |  |             switch (message.Response.Status) | 
|  |  | 98 |  |             { | 
|  |  | 99 |  |                 case 200: | 
|  |  | 100 |  |                 case 201: | 
|  | 4 | 101 |  |                     return message.Response; | 
|  |  | 102 |  |                 default: | 
|  | 0 | 103 |  |                     throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa | 
|  |  | 104 |  |             } | 
|  | 4 | 105 |  |         } | 
|  |  | 106 |  |  | 
|  |  | 107 |  |         /// <summary> The operation to create or update an extension. </summary> | 
|  |  | 108 |  |         /// <param name="resourceGroupName"> The name of the resource group. </param> | 
|  |  | 109 |  |         /// <param name="vmScaleSetName"> The name of the VM scale set where the extension should be create or updated.  | 
|  |  | 110 |  |         /// <param name="vmssExtensionName"> The name of the VM scale set extension. </param> | 
|  |  | 111 |  |         /// <param name="extensionParameters"> Parameters supplied to the Create VM scale set Extension operation. </par | 
|  |  | 112 |  |         /// <param name="cancellationToken"> The cancellation token to use. </param> | 
|  |  | 113 |  |         public Response CreateOrUpdate(string resourceGroupName, string vmScaleSetName, string vmssExtensionName, Virtua | 
|  |  | 114 |  |         { | 
|  | 4 | 115 |  |             if (resourceGroupName == null) | 
|  |  | 116 |  |             { | 
|  | 0 | 117 |  |                 throw new ArgumentNullException(nameof(resourceGroupName)); | 
|  |  | 118 |  |             } | 
|  | 4 | 119 |  |             if (vmScaleSetName == null) | 
|  |  | 120 |  |             { | 
|  | 0 | 121 |  |                 throw new ArgumentNullException(nameof(vmScaleSetName)); | 
|  |  | 122 |  |             } | 
|  | 4 | 123 |  |             if (vmssExtensionName == null) | 
|  |  | 124 |  |             { | 
|  | 0 | 125 |  |                 throw new ArgumentNullException(nameof(vmssExtensionName)); | 
|  |  | 126 |  |             } | 
|  | 4 | 127 |  |             if (extensionParameters == null) | 
|  |  | 128 |  |             { | 
|  | 0 | 129 |  |                 throw new ArgumentNullException(nameof(extensionParameters)); | 
|  |  | 130 |  |             } | 
|  |  | 131 |  |  | 
|  | 4 | 132 |  |             using var message = CreateCreateOrUpdateRequest(resourceGroupName, vmScaleSetName, vmssExtensionName, extens | 
|  | 4 | 133 |  |             _pipeline.Send(message, cancellationToken); | 
|  | 4 | 134 |  |             switch (message.Response.Status) | 
|  |  | 135 |  |             { | 
|  |  | 136 |  |                 case 200: | 
|  |  | 137 |  |                 case 201: | 
|  | 4 | 138 |  |                     return message.Response; | 
|  |  | 139 |  |                 default: | 
|  | 0 | 140 |  |                     throw _clientDiagnostics.CreateRequestFailedException(message.Response); | 
|  |  | 141 |  |             } | 
|  | 4 | 142 |  |         } | 
|  |  | 143 |  |  | 
|  |  | 144 |  |         internal HttpMessage CreateUpdateRequest(string resourceGroupName, string vmScaleSetName, string vmssExtensionNa | 
|  |  | 145 |  |         { | 
|  | 0 | 146 |  |             var message = _pipeline.CreateMessage(); | 
|  | 0 | 147 |  |             var request = message.Request; | 
|  | 0 | 148 |  |             request.Method = RequestMethod.Patch; | 
|  | 0 | 149 |  |             var uri = new RawRequestUriBuilder(); | 
|  | 0 | 150 |  |             uri.Reset(endpoint); | 
|  | 0 | 151 |  |             uri.AppendPath("/subscriptions/", false); | 
|  | 0 | 152 |  |             uri.AppendPath(subscriptionId, true); | 
|  | 0 | 153 |  |             uri.AppendPath("/resourceGroups/", false); | 
|  | 0 | 154 |  |             uri.AppendPath(resourceGroupName, true); | 
|  | 0 | 155 |  |             uri.AppendPath("/providers/Microsoft.Compute/virtualMachineScaleSets/", false); | 
|  | 0 | 156 |  |             uri.AppendPath(vmScaleSetName, true); | 
|  | 0 | 157 |  |             uri.AppendPath("/extensions/", false); | 
|  | 0 | 158 |  |             uri.AppendPath(vmssExtensionName, true); | 
|  | 0 | 159 |  |             uri.AppendQuery("api-version", "2019-12-01", true); | 
|  | 0 | 160 |  |             request.Uri = uri; | 
|  | 0 | 161 |  |             request.Headers.Add("Content-Type", "application/json"); | 
|  | 0 | 162 |  |             var content = new Utf8JsonRequestContent(); | 
|  | 0 | 163 |  |             content.JsonWriter.WriteObjectValue(extensionParameters); | 
|  | 0 | 164 |  |             request.Content = content; | 
|  | 0 | 165 |  |             return message; | 
|  |  | 166 |  |         } | 
|  |  | 167 |  |  | 
|  |  | 168 |  |         /// <summary> The operation to update an extension. </summary> | 
|  |  | 169 |  |         /// <param name="resourceGroupName"> The name of the resource group. </param> | 
|  |  | 170 |  |         /// <param name="vmScaleSetName"> The name of the VM scale set where the extension should be updated. </param> | 
|  |  | 171 |  |         /// <param name="vmssExtensionName"> The name of the VM scale set extension. </param> | 
|  |  | 172 |  |         /// <param name="extensionParameters"> Parameters supplied to the Update VM scale set Extension operation. </par | 
|  |  | 173 |  |         /// <param name="cancellationToken"> The cancellation token to use. </param> | 
|  |  | 174 |  |         public async Task<Response> UpdateAsync(string resourceGroupName, string vmScaleSetName, string vmssExtensionNam | 
|  |  | 175 |  |         { | 
|  | 0 | 176 |  |             if (resourceGroupName == null) | 
|  |  | 177 |  |             { | 
|  | 0 | 178 |  |                 throw new ArgumentNullException(nameof(resourceGroupName)); | 
|  |  | 179 |  |             } | 
|  | 0 | 180 |  |             if (vmScaleSetName == null) | 
|  |  | 181 |  |             { | 
|  | 0 | 182 |  |                 throw new ArgumentNullException(nameof(vmScaleSetName)); | 
|  |  | 183 |  |             } | 
|  | 0 | 184 |  |             if (vmssExtensionName == null) | 
|  |  | 185 |  |             { | 
|  | 0 | 186 |  |                 throw new ArgumentNullException(nameof(vmssExtensionName)); | 
|  |  | 187 |  |             } | 
|  | 0 | 188 |  |             if (extensionParameters == null) | 
|  |  | 189 |  |             { | 
|  | 0 | 190 |  |                 throw new ArgumentNullException(nameof(extensionParameters)); | 
|  |  | 191 |  |             } | 
|  |  | 192 |  |  | 
|  | 0 | 193 |  |             using var message = CreateUpdateRequest(resourceGroupName, vmScaleSetName, vmssExtensionName, extensionParam | 
|  | 0 | 194 |  |             await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); | 
|  | 0 | 195 |  |             switch (message.Response.Status) | 
|  |  | 196 |  |             { | 
|  |  | 197 |  |                 case 200: | 
|  |  | 198 |  |                 case 201: | 
|  | 0 | 199 |  |                     return message.Response; | 
|  |  | 200 |  |                 default: | 
|  | 0 | 201 |  |                     throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa | 
|  |  | 202 |  |             } | 
|  | 0 | 203 |  |         } | 
|  |  | 204 |  |  | 
|  |  | 205 |  |         /// <summary> The operation to update an extension. </summary> | 
|  |  | 206 |  |         /// <param name="resourceGroupName"> The name of the resource group. </param> | 
|  |  | 207 |  |         /// <param name="vmScaleSetName"> The name of the VM scale set where the extension should be updated. </param> | 
|  |  | 208 |  |         /// <param name="vmssExtensionName"> The name of the VM scale set extension. </param> | 
|  |  | 209 |  |         /// <param name="extensionParameters"> Parameters supplied to the Update VM scale set Extension operation. </par | 
|  |  | 210 |  |         /// <param name="cancellationToken"> The cancellation token to use. </param> | 
|  |  | 211 |  |         public Response Update(string resourceGroupName, string vmScaleSetName, string vmssExtensionName, VirtualMachine | 
|  |  | 212 |  |         { | 
|  | 0 | 213 |  |             if (resourceGroupName == null) | 
|  |  | 214 |  |             { | 
|  | 0 | 215 |  |                 throw new ArgumentNullException(nameof(resourceGroupName)); | 
|  |  | 216 |  |             } | 
|  | 0 | 217 |  |             if (vmScaleSetName == null) | 
|  |  | 218 |  |             { | 
|  | 0 | 219 |  |                 throw new ArgumentNullException(nameof(vmScaleSetName)); | 
|  |  | 220 |  |             } | 
|  | 0 | 221 |  |             if (vmssExtensionName == null) | 
|  |  | 222 |  |             { | 
|  | 0 | 223 |  |                 throw new ArgumentNullException(nameof(vmssExtensionName)); | 
|  |  | 224 |  |             } | 
|  | 0 | 225 |  |             if (extensionParameters == null) | 
|  |  | 226 |  |             { | 
|  | 0 | 227 |  |                 throw new ArgumentNullException(nameof(extensionParameters)); | 
|  |  | 228 |  |             } | 
|  |  | 229 |  |  | 
|  | 0 | 230 |  |             using var message = CreateUpdateRequest(resourceGroupName, vmScaleSetName, vmssExtensionName, extensionParam | 
|  | 0 | 231 |  |             _pipeline.Send(message, cancellationToken); | 
|  | 0 | 232 |  |             switch (message.Response.Status) | 
|  |  | 233 |  |             { | 
|  |  | 234 |  |                 case 200: | 
|  |  | 235 |  |                 case 201: | 
|  | 0 | 236 |  |                     return message.Response; | 
|  |  | 237 |  |                 default: | 
|  | 0 | 238 |  |                     throw _clientDiagnostics.CreateRequestFailedException(message.Response); | 
|  |  | 239 |  |             } | 
|  | 0 | 240 |  |         } | 
|  |  | 241 |  |  | 
|  |  | 242 |  |         internal HttpMessage CreateDeleteRequest(string resourceGroupName, string vmScaleSetName, string vmssExtensionNa | 
|  |  | 243 |  |         { | 
|  | 0 | 244 |  |             var message = _pipeline.CreateMessage(); | 
|  | 0 | 245 |  |             var request = message.Request; | 
|  | 0 | 246 |  |             request.Method = RequestMethod.Delete; | 
|  | 0 | 247 |  |             var uri = new RawRequestUriBuilder(); | 
|  | 0 | 248 |  |             uri.Reset(endpoint); | 
|  | 0 | 249 |  |             uri.AppendPath("/subscriptions/", false); | 
|  | 0 | 250 |  |             uri.AppendPath(subscriptionId, true); | 
|  | 0 | 251 |  |             uri.AppendPath("/resourceGroups/", false); | 
|  | 0 | 252 |  |             uri.AppendPath(resourceGroupName, true); | 
|  | 0 | 253 |  |             uri.AppendPath("/providers/Microsoft.Compute/virtualMachineScaleSets/", false); | 
|  | 0 | 254 |  |             uri.AppendPath(vmScaleSetName, true); | 
|  | 0 | 255 |  |             uri.AppendPath("/extensions/", false); | 
|  | 0 | 256 |  |             uri.AppendPath(vmssExtensionName, true); | 
|  | 0 | 257 |  |             uri.AppendQuery("api-version", "2019-12-01", true); | 
|  | 0 | 258 |  |             request.Uri = uri; | 
|  | 0 | 259 |  |             return message; | 
|  |  | 260 |  |         } | 
|  |  | 261 |  |  | 
|  |  | 262 |  |         /// <summary> The operation to delete the extension. </summary> | 
|  |  | 263 |  |         /// <param name="resourceGroupName"> The name of the resource group. </param> | 
|  |  | 264 |  |         /// <param name="vmScaleSetName"> The name of the VM scale set where the extension should be deleted. </param> | 
|  |  | 265 |  |         /// <param name="vmssExtensionName"> The name of the VM scale set extension. </param> | 
|  |  | 266 |  |         /// <param name="cancellationToken"> The cancellation token to use. </param> | 
|  |  | 267 |  |         public async Task<Response> DeleteAsync(string resourceGroupName, string vmScaleSetName, string vmssExtensionNam | 
|  |  | 268 |  |         { | 
|  | 0 | 269 |  |             if (resourceGroupName == null) | 
|  |  | 270 |  |             { | 
|  | 0 | 271 |  |                 throw new ArgumentNullException(nameof(resourceGroupName)); | 
|  |  | 272 |  |             } | 
|  | 0 | 273 |  |             if (vmScaleSetName == null) | 
|  |  | 274 |  |             { | 
|  | 0 | 275 |  |                 throw new ArgumentNullException(nameof(vmScaleSetName)); | 
|  |  | 276 |  |             } | 
|  | 0 | 277 |  |             if (vmssExtensionName == null) | 
|  |  | 278 |  |             { | 
|  | 0 | 279 |  |                 throw new ArgumentNullException(nameof(vmssExtensionName)); | 
|  |  | 280 |  |             } | 
|  |  | 281 |  |  | 
|  | 0 | 282 |  |             using var message = CreateDeleteRequest(resourceGroupName, vmScaleSetName, vmssExtensionName); | 
|  | 0 | 283 |  |             await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); | 
|  | 0 | 284 |  |             switch (message.Response.Status) | 
|  |  | 285 |  |             { | 
|  |  | 286 |  |                 case 200: | 
|  |  | 287 |  |                 case 202: | 
|  |  | 288 |  |                 case 204: | 
|  | 0 | 289 |  |                     return message.Response; | 
|  |  | 290 |  |                 default: | 
|  | 0 | 291 |  |                     throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa | 
|  |  | 292 |  |             } | 
|  | 0 | 293 |  |         } | 
|  |  | 294 |  |  | 
|  |  | 295 |  |         /// <summary> The operation to delete the extension. </summary> | 
|  |  | 296 |  |         /// <param name="resourceGroupName"> The name of the resource group. </param> | 
|  |  | 297 |  |         /// <param name="vmScaleSetName"> The name of the VM scale set where the extension should be deleted. </param> | 
|  |  | 298 |  |         /// <param name="vmssExtensionName"> The name of the VM scale set extension. </param> | 
|  |  | 299 |  |         /// <param name="cancellationToken"> The cancellation token to use. </param> | 
|  |  | 300 |  |         public Response Delete(string resourceGroupName, string vmScaleSetName, string vmssExtensionName, CancellationTo | 
|  |  | 301 |  |         { | 
|  | 0 | 302 |  |             if (resourceGroupName == null) | 
|  |  | 303 |  |             { | 
|  | 0 | 304 |  |                 throw new ArgumentNullException(nameof(resourceGroupName)); | 
|  |  | 305 |  |             } | 
|  | 0 | 306 |  |             if (vmScaleSetName == null) | 
|  |  | 307 |  |             { | 
|  | 0 | 308 |  |                 throw new ArgumentNullException(nameof(vmScaleSetName)); | 
|  |  | 309 |  |             } | 
|  | 0 | 310 |  |             if (vmssExtensionName == null) | 
|  |  | 311 |  |             { | 
|  | 0 | 312 |  |                 throw new ArgumentNullException(nameof(vmssExtensionName)); | 
|  |  | 313 |  |             } | 
|  |  | 314 |  |  | 
|  | 0 | 315 |  |             using var message = CreateDeleteRequest(resourceGroupName, vmScaleSetName, vmssExtensionName); | 
|  | 0 | 316 |  |             _pipeline.Send(message, cancellationToken); | 
|  | 0 | 317 |  |             switch (message.Response.Status) | 
|  |  | 318 |  |             { | 
|  |  | 319 |  |                 case 200: | 
|  |  | 320 |  |                 case 202: | 
|  |  | 321 |  |                 case 204: | 
|  | 0 | 322 |  |                     return message.Response; | 
|  |  | 323 |  |                 default: | 
|  | 0 | 324 |  |                     throw _clientDiagnostics.CreateRequestFailedException(message.Response); | 
|  |  | 325 |  |             } | 
|  | 0 | 326 |  |         } | 
|  |  | 327 |  |  | 
|  |  | 328 |  |         internal HttpMessage CreateGetRequest(string resourceGroupName, string vmScaleSetName, string vmssExtensionName, | 
|  |  | 329 |  |         { | 
|  | 12 | 330 |  |             var message = _pipeline.CreateMessage(); | 
|  | 12 | 331 |  |             var request = message.Request; | 
|  | 12 | 332 |  |             request.Method = RequestMethod.Get; | 
|  | 12 | 333 |  |             var uri = new RawRequestUriBuilder(); | 
|  | 12 | 334 |  |             uri.Reset(endpoint); | 
|  | 12 | 335 |  |             uri.AppendPath("/subscriptions/", false); | 
|  | 12 | 336 |  |             uri.AppendPath(subscriptionId, true); | 
|  | 12 | 337 |  |             uri.AppendPath("/resourceGroups/", false); | 
|  | 12 | 338 |  |             uri.AppendPath(resourceGroupName, true); | 
|  | 12 | 339 |  |             uri.AppendPath("/providers/Microsoft.Compute/virtualMachineScaleSets/", false); | 
|  | 12 | 340 |  |             uri.AppendPath(vmScaleSetName, true); | 
|  | 12 | 341 |  |             uri.AppendPath("/extensions/", false); | 
|  | 12 | 342 |  |             uri.AppendPath(vmssExtensionName, true); | 
|  | 12 | 343 |  |             if (expand != null) | 
|  |  | 344 |  |             { | 
|  | 0 | 345 |  |                 uri.AppendQuery("$expand", expand, true); | 
|  |  | 346 |  |             } | 
|  | 12 | 347 |  |             uri.AppendQuery("api-version", "2019-12-01", true); | 
|  | 12 | 348 |  |             request.Uri = uri; | 
|  | 12 | 349 |  |             return message; | 
|  |  | 350 |  |         } | 
|  |  | 351 |  |  | 
|  |  | 352 |  |         /// <summary> The operation to get the extension. </summary> | 
|  |  | 353 |  |         /// <param name="resourceGroupName"> The name of the resource group. </param> | 
|  |  | 354 |  |         /// <param name="vmScaleSetName"> The name of the VM scale set containing the extension. </param> | 
|  |  | 355 |  |         /// <param name="vmssExtensionName"> The name of the VM scale set extension. </param> | 
|  |  | 356 |  |         /// <param name="expand"> The expand expression to apply on the operation. </param> | 
|  |  | 357 |  |         /// <param name="cancellationToken"> The cancellation token to use. </param> | 
|  |  | 358 |  |         public async Task<Response<VirtualMachineScaleSetExtension>> GetAsync(string resourceGroupName, string vmScaleSe | 
|  |  | 359 |  |         { | 
|  | 6 | 360 |  |             if (resourceGroupName == null) | 
|  |  | 361 |  |             { | 
|  | 0 | 362 |  |                 throw new ArgumentNullException(nameof(resourceGroupName)); | 
|  |  | 363 |  |             } | 
|  | 6 | 364 |  |             if (vmScaleSetName == null) | 
|  |  | 365 |  |             { | 
|  | 0 | 366 |  |                 throw new ArgumentNullException(nameof(vmScaleSetName)); | 
|  |  | 367 |  |             } | 
|  | 6 | 368 |  |             if (vmssExtensionName == null) | 
|  |  | 369 |  |             { | 
|  | 0 | 370 |  |                 throw new ArgumentNullException(nameof(vmssExtensionName)); | 
|  |  | 371 |  |             } | 
|  |  | 372 |  |  | 
|  | 6 | 373 |  |             using var message = CreateGetRequest(resourceGroupName, vmScaleSetName, vmssExtensionName, expand); | 
|  | 6 | 374 |  |             await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); | 
|  | 6 | 375 |  |             switch (message.Response.Status) | 
|  |  | 376 |  |             { | 
|  |  | 377 |  |                 case 200: | 
|  |  | 378 |  |                     { | 
|  | 6 | 379 |  |                         VirtualMachineScaleSetExtension value = default; | 
|  | 6 | 380 |  |                         using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc | 
|  | 6 | 381 |  |                         if (document.RootElement.ValueKind == JsonValueKind.Null) | 
|  |  | 382 |  |                         { | 
|  | 0 | 383 |  |                             value = null; | 
|  |  | 384 |  |                         } | 
|  |  | 385 |  |                         else | 
|  |  | 386 |  |                         { | 
|  | 6 | 387 |  |                             value = VirtualMachineScaleSetExtension.DeserializeVirtualMachineScaleSetExtension(document. | 
|  |  | 388 |  |                         } | 
|  | 6 | 389 |  |                         return Response.FromValue(value, message.Response); | 
|  |  | 390 |  |                     } | 
|  |  | 391 |  |                 default: | 
|  | 0 | 392 |  |                     throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa | 
|  |  | 393 |  |             } | 
|  | 6 | 394 |  |         } | 
|  |  | 395 |  |  | 
|  |  | 396 |  |         /// <summary> The operation to get the extension. </summary> | 
|  |  | 397 |  |         /// <param name="resourceGroupName"> The name of the resource group. </param> | 
|  |  | 398 |  |         /// <param name="vmScaleSetName"> The name of the VM scale set containing the extension. </param> | 
|  |  | 399 |  |         /// <param name="vmssExtensionName"> The name of the VM scale set extension. </param> | 
|  |  | 400 |  |         /// <param name="expand"> The expand expression to apply on the operation. </param> | 
|  |  | 401 |  |         /// <param name="cancellationToken"> The cancellation token to use. </param> | 
|  |  | 402 |  |         public Response<VirtualMachineScaleSetExtension> Get(string resourceGroupName, string vmScaleSetName, string vms | 
|  |  | 403 |  |         { | 
|  | 6 | 404 |  |             if (resourceGroupName == null) | 
|  |  | 405 |  |             { | 
|  | 0 | 406 |  |                 throw new ArgumentNullException(nameof(resourceGroupName)); | 
|  |  | 407 |  |             } | 
|  | 6 | 408 |  |             if (vmScaleSetName == null) | 
|  |  | 409 |  |             { | 
|  | 0 | 410 |  |                 throw new ArgumentNullException(nameof(vmScaleSetName)); | 
|  |  | 411 |  |             } | 
|  | 6 | 412 |  |             if (vmssExtensionName == null) | 
|  |  | 413 |  |             { | 
|  | 0 | 414 |  |                 throw new ArgumentNullException(nameof(vmssExtensionName)); | 
|  |  | 415 |  |             } | 
|  |  | 416 |  |  | 
|  | 6 | 417 |  |             using var message = CreateGetRequest(resourceGroupName, vmScaleSetName, vmssExtensionName, expand); | 
|  | 6 | 418 |  |             _pipeline.Send(message, cancellationToken); | 
|  | 6 | 419 |  |             switch (message.Response.Status) | 
|  |  | 420 |  |             { | 
|  |  | 421 |  |                 case 200: | 
|  |  | 422 |  |                     { | 
|  | 6 | 423 |  |                         VirtualMachineScaleSetExtension value = default; | 
|  | 6 | 424 |  |                         using var document = JsonDocument.Parse(message.Response.ContentStream); | 
|  | 6 | 425 |  |                         if (document.RootElement.ValueKind == JsonValueKind.Null) | 
|  |  | 426 |  |                         { | 
|  | 0 | 427 |  |                             value = null; | 
|  |  | 428 |  |                         } | 
|  |  | 429 |  |                         else | 
|  |  | 430 |  |                         { | 
|  | 6 | 431 |  |                             value = VirtualMachineScaleSetExtension.DeserializeVirtualMachineScaleSetExtension(document. | 
|  |  | 432 |  |                         } | 
|  | 6 | 433 |  |                         return Response.FromValue(value, message.Response); | 
|  |  | 434 |  |                     } | 
|  |  | 435 |  |                 default: | 
|  | 0 | 436 |  |                     throw _clientDiagnostics.CreateRequestFailedException(message.Response); | 
|  |  | 437 |  |             } | 
|  | 6 | 438 |  |         } | 
|  |  | 439 |  |  | 
|  |  | 440 |  |         internal HttpMessage CreateListRequest(string resourceGroupName, string vmScaleSetName) | 
|  |  | 441 |  |         { | 
|  | 4 | 442 |  |             var message = _pipeline.CreateMessage(); | 
|  | 4 | 443 |  |             var request = message.Request; | 
|  | 4 | 444 |  |             request.Method = RequestMethod.Get; | 
|  | 4 | 445 |  |             var uri = new RawRequestUriBuilder(); | 
|  | 4 | 446 |  |             uri.Reset(endpoint); | 
|  | 4 | 447 |  |             uri.AppendPath("/subscriptions/", false); | 
|  | 4 | 448 |  |             uri.AppendPath(subscriptionId, true); | 
|  | 4 | 449 |  |             uri.AppendPath("/resourceGroups/", false); | 
|  | 4 | 450 |  |             uri.AppendPath(resourceGroupName, true); | 
|  | 4 | 451 |  |             uri.AppendPath("/providers/Microsoft.Compute/virtualMachineScaleSets/", false); | 
|  | 4 | 452 |  |             uri.AppendPath(vmScaleSetName, true); | 
|  | 4 | 453 |  |             uri.AppendPath("/extensions", false); | 
|  | 4 | 454 |  |             uri.AppendQuery("api-version", "2019-12-01", true); | 
|  | 4 | 455 |  |             request.Uri = uri; | 
|  | 4 | 456 |  |             return message; | 
|  |  | 457 |  |         } | 
|  |  | 458 |  |  | 
|  |  | 459 |  |         /// <summary> Gets a list of all extensions in a VM scale set. </summary> | 
|  |  | 460 |  |         /// <param name="resourceGroupName"> The name of the resource group. </param> | 
|  |  | 461 |  |         /// <param name="vmScaleSetName"> The name of the VM scale set containing the extension. </param> | 
|  |  | 462 |  |         /// <param name="cancellationToken"> The cancellation token to use. </param> | 
|  |  | 463 |  |         public async Task<Response<VirtualMachineScaleSetExtensionListResult>> ListAsync(string resourceGroupName, strin | 
|  |  | 464 |  |         { | 
|  | 2 | 465 |  |             if (resourceGroupName == null) | 
|  |  | 466 |  |             { | 
|  | 0 | 467 |  |                 throw new ArgumentNullException(nameof(resourceGroupName)); | 
|  |  | 468 |  |             } | 
|  | 2 | 469 |  |             if (vmScaleSetName == null) | 
|  |  | 470 |  |             { | 
|  | 0 | 471 |  |                 throw new ArgumentNullException(nameof(vmScaleSetName)); | 
|  |  | 472 |  |             } | 
|  |  | 473 |  |  | 
|  | 2 | 474 |  |             using var message = CreateListRequest(resourceGroupName, vmScaleSetName); | 
|  | 2 | 475 |  |             await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); | 
|  | 2 | 476 |  |             switch (message.Response.Status) | 
|  |  | 477 |  |             { | 
|  |  | 478 |  |                 case 200: | 
|  |  | 479 |  |                     { | 
|  | 2 | 480 |  |                         VirtualMachineScaleSetExtensionListResult value = default; | 
|  | 2 | 481 |  |                         using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc | 
|  | 2 | 482 |  |                         if (document.RootElement.ValueKind == JsonValueKind.Null) | 
|  |  | 483 |  |                         { | 
|  | 0 | 484 |  |                             value = null; | 
|  |  | 485 |  |                         } | 
|  |  | 486 |  |                         else | 
|  |  | 487 |  |                         { | 
|  | 2 | 488 |  |                             value = VirtualMachineScaleSetExtensionListResult.DeserializeVirtualMachineScaleSetExtension | 
|  |  | 489 |  |                         } | 
|  | 2 | 490 |  |                         return Response.FromValue(value, message.Response); | 
|  |  | 491 |  |                     } | 
|  |  | 492 |  |                 default: | 
|  | 0 | 493 |  |                     throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa | 
|  |  | 494 |  |             } | 
|  | 2 | 495 |  |         } | 
|  |  | 496 |  |  | 
|  |  | 497 |  |         /// <summary> Gets a list of all extensions in a VM scale set. </summary> | 
|  |  | 498 |  |         /// <param name="resourceGroupName"> The name of the resource group. </param> | 
|  |  | 499 |  |         /// <param name="vmScaleSetName"> The name of the VM scale set containing the extension. </param> | 
|  |  | 500 |  |         /// <param name="cancellationToken"> The cancellation token to use. </param> | 
|  |  | 501 |  |         public Response<VirtualMachineScaleSetExtensionListResult> List(string resourceGroupName, string vmScaleSetName, | 
|  |  | 502 |  |         { | 
|  | 2 | 503 |  |             if (resourceGroupName == null) | 
|  |  | 504 |  |             { | 
|  | 0 | 505 |  |                 throw new ArgumentNullException(nameof(resourceGroupName)); | 
|  |  | 506 |  |             } | 
|  | 2 | 507 |  |             if (vmScaleSetName == null) | 
|  |  | 508 |  |             { | 
|  | 0 | 509 |  |                 throw new ArgumentNullException(nameof(vmScaleSetName)); | 
|  |  | 510 |  |             } | 
|  |  | 511 |  |  | 
|  | 2 | 512 |  |             using var message = CreateListRequest(resourceGroupName, vmScaleSetName); | 
|  | 2 | 513 |  |             _pipeline.Send(message, cancellationToken); | 
|  | 2 | 514 |  |             switch (message.Response.Status) | 
|  |  | 515 |  |             { | 
|  |  | 516 |  |                 case 200: | 
|  |  | 517 |  |                     { | 
|  | 2 | 518 |  |                         VirtualMachineScaleSetExtensionListResult value = default; | 
|  | 2 | 519 |  |                         using var document = JsonDocument.Parse(message.Response.ContentStream); | 
|  | 2 | 520 |  |                         if (document.RootElement.ValueKind == JsonValueKind.Null) | 
|  |  | 521 |  |                         { | 
|  | 0 | 522 |  |                             value = null; | 
|  |  | 523 |  |                         } | 
|  |  | 524 |  |                         else | 
|  |  | 525 |  |                         { | 
|  | 2 | 526 |  |                             value = VirtualMachineScaleSetExtensionListResult.DeserializeVirtualMachineScaleSetExtension | 
|  |  | 527 |  |                         } | 
|  | 2 | 528 |  |                         return Response.FromValue(value, message.Response); | 
|  |  | 529 |  |                     } | 
|  |  | 530 |  |                 default: | 
|  | 0 | 531 |  |                     throw _clientDiagnostics.CreateRequestFailedException(message.Response); | 
|  |  | 532 |  |             } | 
|  | 2 | 533 |  |         } | 
|  |  | 534 |  |  | 
|  |  | 535 |  |         internal HttpMessage CreateListNextPageRequest(string nextLink, string resourceGroupName, string vmScaleSetName) | 
|  |  | 536 |  |         { | 
|  | 0 | 537 |  |             var message = _pipeline.CreateMessage(); | 
|  | 0 | 538 |  |             var request = message.Request; | 
|  | 0 | 539 |  |             request.Method = RequestMethod.Get; | 
|  | 0 | 540 |  |             var uri = new RawRequestUriBuilder(); | 
|  | 0 | 541 |  |             uri.Reset(endpoint); | 
|  | 0 | 542 |  |             uri.AppendRawNextLink(nextLink, false); | 
|  | 0 | 543 |  |             request.Uri = uri; | 
|  | 0 | 544 |  |             return message; | 
|  |  | 545 |  |         } | 
|  |  | 546 |  |  | 
|  |  | 547 |  |         /// <summary> Gets a list of all extensions in a VM scale set. </summary> | 
|  |  | 548 |  |         /// <param name="nextLink"> The URL to the next page of results. </param> | 
|  |  | 549 |  |         /// <param name="resourceGroupName"> The name of the resource group. </param> | 
|  |  | 550 |  |         /// <param name="vmScaleSetName"> The name of the VM scale set containing the extension. </param> | 
|  |  | 551 |  |         /// <param name="cancellationToken"> The cancellation token to use. </param> | 
|  |  | 552 |  |         public async Task<Response<VirtualMachineScaleSetExtensionListResult>> ListNextPageAsync(string nextLink, string | 
|  |  | 553 |  |         { | 
|  | 0 | 554 |  |             if (nextLink == null) | 
|  |  | 555 |  |             { | 
|  | 0 | 556 |  |                 throw new ArgumentNullException(nameof(nextLink)); | 
|  |  | 557 |  |             } | 
|  | 0 | 558 |  |             if (resourceGroupName == null) | 
|  |  | 559 |  |             { | 
|  | 0 | 560 |  |                 throw new ArgumentNullException(nameof(resourceGroupName)); | 
|  |  | 561 |  |             } | 
|  | 0 | 562 |  |             if (vmScaleSetName == null) | 
|  |  | 563 |  |             { | 
|  | 0 | 564 |  |                 throw new ArgumentNullException(nameof(vmScaleSetName)); | 
|  |  | 565 |  |             } | 
|  |  | 566 |  |  | 
|  | 0 | 567 |  |             using var message = CreateListNextPageRequest(nextLink, resourceGroupName, vmScaleSetName); | 
|  | 0 | 568 |  |             await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); | 
|  | 0 | 569 |  |             switch (message.Response.Status) | 
|  |  | 570 |  |             { | 
|  |  | 571 |  |                 case 200: | 
|  |  | 572 |  |                     { | 
|  | 0 | 573 |  |                         VirtualMachineScaleSetExtensionListResult value = default; | 
|  | 0 | 574 |  |                         using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc | 
|  | 0 | 575 |  |                         if (document.RootElement.ValueKind == JsonValueKind.Null) | 
|  |  | 576 |  |                         { | 
|  | 0 | 577 |  |                             value = null; | 
|  |  | 578 |  |                         } | 
|  |  | 579 |  |                         else | 
|  |  | 580 |  |                         { | 
|  | 0 | 581 |  |                             value = VirtualMachineScaleSetExtensionListResult.DeserializeVirtualMachineScaleSetExtension | 
|  |  | 582 |  |                         } | 
|  | 0 | 583 |  |                         return Response.FromValue(value, message.Response); | 
|  |  | 584 |  |                     } | 
|  |  | 585 |  |                 default: | 
|  | 0 | 586 |  |                     throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa | 
|  |  | 587 |  |             } | 
|  | 0 | 588 |  |         } | 
|  |  | 589 |  |  | 
|  |  | 590 |  |         /// <summary> Gets a list of all extensions in a VM scale set. </summary> | 
|  |  | 591 |  |         /// <param name="nextLink"> The URL to the next page of results. </param> | 
|  |  | 592 |  |         /// <param name="resourceGroupName"> The name of the resource group. </param> | 
|  |  | 593 |  |         /// <param name="vmScaleSetName"> The name of the VM scale set containing the extension. </param> | 
|  |  | 594 |  |         /// <param name="cancellationToken"> The cancellation token to use. </param> | 
|  |  | 595 |  |         public Response<VirtualMachineScaleSetExtensionListResult> ListNextPage(string nextLink, string resourceGroupNam | 
|  |  | 596 |  |         { | 
|  | 0 | 597 |  |             if (nextLink == null) | 
|  |  | 598 |  |             { | 
|  | 0 | 599 |  |                 throw new ArgumentNullException(nameof(nextLink)); | 
|  |  | 600 |  |             } | 
|  | 0 | 601 |  |             if (resourceGroupName == null) | 
|  |  | 602 |  |             { | 
|  | 0 | 603 |  |                 throw new ArgumentNullException(nameof(resourceGroupName)); | 
|  |  | 604 |  |             } | 
|  | 0 | 605 |  |             if (vmScaleSetName == null) | 
|  |  | 606 |  |             { | 
|  | 0 | 607 |  |                 throw new ArgumentNullException(nameof(vmScaleSetName)); | 
|  |  | 608 |  |             } | 
|  |  | 609 |  |  | 
|  | 0 | 610 |  |             using var message = CreateListNextPageRequest(nextLink, resourceGroupName, vmScaleSetName); | 
|  | 0 | 611 |  |             _pipeline.Send(message, cancellationToken); | 
|  | 0 | 612 |  |             switch (message.Response.Status) | 
|  |  | 613 |  |             { | 
|  |  | 614 |  |                 case 200: | 
|  |  | 615 |  |                     { | 
|  | 0 | 616 |  |                         VirtualMachineScaleSetExtensionListResult value = default; | 
|  | 0 | 617 |  |                         using var document = JsonDocument.Parse(message.Response.ContentStream); | 
|  | 0 | 618 |  |                         if (document.RootElement.ValueKind == JsonValueKind.Null) | 
|  |  | 619 |  |                         { | 
|  | 0 | 620 |  |                             value = null; | 
|  |  | 621 |  |                         } | 
|  |  | 622 |  |                         else | 
|  |  | 623 |  |                         { | 
|  | 0 | 624 |  |                             value = VirtualMachineScaleSetExtensionListResult.DeserializeVirtualMachineScaleSetExtension | 
|  |  | 625 |  |                         } | 
|  | 0 | 626 |  |                         return Response.FromValue(value, message.Response); | 
|  |  | 627 |  |                     } | 
|  |  | 628 |  |                 default: | 
|  | 0 | 629 |  |                     throw _clientDiagnostics.CreateRequestFailedException(message.Response); | 
|  |  | 630 |  |             } | 
|  | 0 | 631 |  |         } | 
|  |  | 632 |  |     } | 
|  |  | 633 |  | } |