| | 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.Security.KeyVault.Administration.Models; |
| | 16 | |
|
| | 17 | | namespace Azure.Security.KeyVault.Administration |
| | 18 | | { |
| | 19 | | internal partial class RoleAssignmentsRestClient |
| | 20 | | { |
| | 21 | | private string apiVersion; |
| | 22 | | private ClientDiagnostics _clientDiagnostics; |
| | 23 | | private HttpPipeline _pipeline; |
| | 24 | |
|
| | 25 | | /// <summary> Initializes a new instance of RoleAssignmentsRestClient. </summary> |
| | 26 | | /// <param name="clientDiagnostics"> The handler for diagnostic messaging in the client. </param> |
| | 27 | | /// <param name="pipeline"> The HTTP pipeline for sending and receiving REST requests and responses. </param> |
| | 28 | | /// <param name="apiVersion"> Api Version. </param> |
| | 29 | | /// <exception cref="ArgumentNullException"> <paramref name="apiVersion"/> is null. </exception> |
| 42 | 30 | | public RoleAssignmentsRestClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string apiVersion = |
| | 31 | | { |
| 42 | 32 | | if (apiVersion == null) |
| | 33 | | { |
| 0 | 34 | | throw new ArgumentNullException(nameof(apiVersion)); |
| | 35 | | } |
| | 36 | |
|
| 42 | 37 | | this.apiVersion = apiVersion; |
| 42 | 38 | | _clientDiagnostics = clientDiagnostics; |
| 42 | 39 | | _pipeline = pipeline; |
| 42 | 40 | | } |
| | 41 | |
|
| | 42 | | internal HttpMessage CreateDeleteRequest(string vaultBaseUrl, string scope, string roleAssignmentName) |
| | 43 | | { |
| 10 | 44 | | var message = _pipeline.CreateMessage(); |
| 10 | 45 | | var request = message.Request; |
| 10 | 46 | | request.Method = RequestMethod.Delete; |
| 10 | 47 | | var uri = new RawRequestUriBuilder(); |
| 10 | 48 | | uri.AppendRaw(vaultBaseUrl, false); |
| 10 | 49 | | uri.AppendPath("/", false); |
| 10 | 50 | | uri.AppendPath(scope, false); |
| 10 | 51 | | uri.AppendPath("/providers/Microsoft.Authorization/roleAssignments/", false); |
| 10 | 52 | | uri.AppendPath(roleAssignmentName, true); |
| 10 | 53 | | uri.AppendQuery("api-version", apiVersion, true); |
| 10 | 54 | | request.Uri = uri; |
| 10 | 55 | | return message; |
| | 56 | | } |
| | 57 | |
|
| | 58 | | /// <summary> Deletes a role assignment. </summary> |
| | 59 | | /// <param name="vaultBaseUrl"> The vault name, for example https://myvault.vault.azure.net. </param> |
| | 60 | | /// <param name="scope"> The scope of the role assignment to delete. </param> |
| | 61 | | /// <param name="roleAssignmentName"> The name of the role assignment to delete. </param> |
| | 62 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 63 | | /// <exception cref="ArgumentNullException"> <paramref name="vaultBaseUrl"/>, <paramref name="scope"/>, or <para |
| | 64 | | public async Task<Response<RoleAssignment>> DeleteAsync(string vaultBaseUrl, string scope, string roleAssignment |
| | 65 | | { |
| 4 | 66 | | if (vaultBaseUrl == null) |
| | 67 | | { |
| 0 | 68 | | throw new ArgumentNullException(nameof(vaultBaseUrl)); |
| | 69 | | } |
| 4 | 70 | | if (scope == null) |
| | 71 | | { |
| 0 | 72 | | throw new ArgumentNullException(nameof(scope)); |
| | 73 | | } |
| 4 | 74 | | if (roleAssignmentName == null) |
| | 75 | | { |
| 0 | 76 | | throw new ArgumentNullException(nameof(roleAssignmentName)); |
| | 77 | | } |
| | 78 | |
|
| 4 | 79 | | using var message = CreateDeleteRequest(vaultBaseUrl, scope, roleAssignmentName); |
| 4 | 80 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 4 | 81 | | switch (message.Response.Status) |
| | 82 | | { |
| | 83 | | case 200: |
| | 84 | | { |
| | 85 | | RoleAssignment value = default; |
| 4 | 86 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 4 | 87 | | value = RoleAssignment.DeserializeRoleAssignment(document.RootElement); |
| 4 | 88 | | return Response.FromValue(value, message.Response); |
| | 89 | | } |
| | 90 | | default: |
| 0 | 91 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 92 | | } |
| 4 | 93 | | } |
| | 94 | |
|
| | 95 | | /// <summary> Deletes a role assignment. </summary> |
| | 96 | | /// <param name="vaultBaseUrl"> The vault name, for example https://myvault.vault.azure.net. </param> |
| | 97 | | /// <param name="scope"> The scope of the role assignment to delete. </param> |
| | 98 | | /// <param name="roleAssignmentName"> The name of the role assignment to delete. </param> |
| | 99 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 100 | | /// <exception cref="ArgumentNullException"> <paramref name="vaultBaseUrl"/>, <paramref name="scope"/>, or <para |
| | 101 | | public Response<RoleAssignment> Delete(string vaultBaseUrl, string scope, string roleAssignmentName, Cancellatio |
| | 102 | | { |
| 6 | 103 | | if (vaultBaseUrl == null) |
| | 104 | | { |
| 0 | 105 | | throw new ArgumentNullException(nameof(vaultBaseUrl)); |
| | 106 | | } |
| 6 | 107 | | if (scope == null) |
| | 108 | | { |
| 0 | 109 | | throw new ArgumentNullException(nameof(scope)); |
| | 110 | | } |
| 6 | 111 | | if (roleAssignmentName == null) |
| | 112 | | { |
| 0 | 113 | | throw new ArgumentNullException(nameof(roleAssignmentName)); |
| | 114 | | } |
| | 115 | |
|
| 6 | 116 | | using var message = CreateDeleteRequest(vaultBaseUrl, scope, roleAssignmentName); |
| 6 | 117 | | _pipeline.Send(message, cancellationToken); |
| 6 | 118 | | switch (message.Response.Status) |
| | 119 | | { |
| | 120 | | case 200: |
| | 121 | | { |
| | 122 | | RoleAssignment value = default; |
| 6 | 123 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 6 | 124 | | value = RoleAssignment.DeserializeRoleAssignment(document.RootElement); |
| 6 | 125 | | return Response.FromValue(value, message.Response); |
| | 126 | | } |
| | 127 | | default: |
| 0 | 128 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 129 | | } |
| 6 | 130 | | } |
| | 131 | |
|
| | 132 | | internal HttpMessage CreateCreateRequest(string vaultBaseUrl, string scope, string roleAssignmentName, RoleAssig |
| | 133 | | { |
| 26 | 134 | | var message = _pipeline.CreateMessage(); |
| 26 | 135 | | var request = message.Request; |
| 26 | 136 | | request.Method = RequestMethod.Put; |
| 26 | 137 | | var uri = new RawRequestUriBuilder(); |
| 26 | 138 | | uri.AppendRaw(vaultBaseUrl, false); |
| 26 | 139 | | uri.AppendPath("/", false); |
| 26 | 140 | | uri.AppendPath(scope, false); |
| 26 | 141 | | uri.AppendPath("/providers/Microsoft.Authorization/roleAssignments/", false); |
| 26 | 142 | | uri.AppendPath(roleAssignmentName, true); |
| 26 | 143 | | uri.AppendQuery("api-version", apiVersion, true); |
| 26 | 144 | | request.Uri = uri; |
| 26 | 145 | | request.Headers.Add("Content-Type", "application/json"); |
| 26 | 146 | | var content = new Utf8JsonRequestContent(); |
| 26 | 147 | | content.JsonWriter.WriteObjectValue(parameters); |
| 26 | 148 | | request.Content = content; |
| 26 | 149 | | return message; |
| | 150 | | } |
| | 151 | |
|
| | 152 | | /// <summary> Creates a role assignment. </summary> |
| | 153 | | /// <param name="vaultBaseUrl"> The vault name, for example https://myvault.vault.azure.net. </param> |
| | 154 | | /// <param name="scope"> The scope of the role assignment to create. </param> |
| | 155 | | /// <param name="roleAssignmentName"> The name of the role assignment to create. It can be any valid GUID. </par |
| | 156 | | /// <param name="parameters"> Parameters for the role assignment. </param> |
| | 157 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 158 | | /// <exception cref="ArgumentNullException"> <paramref name="vaultBaseUrl"/>, <paramref name="scope"/>, <paramre |
| | 159 | | public async Task<Response<RoleAssignment>> CreateAsync(string vaultBaseUrl, string scope, string roleAssignment |
| | 160 | | { |
| 12 | 161 | | if (vaultBaseUrl == null) |
| | 162 | | { |
| 0 | 163 | | throw new ArgumentNullException(nameof(vaultBaseUrl)); |
| | 164 | | } |
| 12 | 165 | | if (scope == null) |
| | 166 | | { |
| 0 | 167 | | throw new ArgumentNullException(nameof(scope)); |
| | 168 | | } |
| 12 | 169 | | if (roleAssignmentName == null) |
| | 170 | | { |
| 0 | 171 | | throw new ArgumentNullException(nameof(roleAssignmentName)); |
| | 172 | | } |
| 12 | 173 | | if (parameters == null) |
| | 174 | | { |
| 0 | 175 | | throw new ArgumentNullException(nameof(parameters)); |
| | 176 | | } |
| | 177 | |
|
| 12 | 178 | | using var message = CreateCreateRequest(vaultBaseUrl, scope, roleAssignmentName, parameters); |
| 12 | 179 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 12 | 180 | | switch (message.Response.Status) |
| | 181 | | { |
| | 182 | | case 201: |
| | 183 | | { |
| | 184 | | RoleAssignment value = default; |
| 12 | 185 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 12 | 186 | | value = RoleAssignment.DeserializeRoleAssignment(document.RootElement); |
| 12 | 187 | | return Response.FromValue(value, message.Response); |
| | 188 | | } |
| | 189 | | default: |
| 0 | 190 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 191 | | } |
| 12 | 192 | | } |
| | 193 | |
|
| | 194 | | /// <summary> Creates a role assignment. </summary> |
| | 195 | | /// <param name="vaultBaseUrl"> The vault name, for example https://myvault.vault.azure.net. </param> |
| | 196 | | /// <param name="scope"> The scope of the role assignment to create. </param> |
| | 197 | | /// <param name="roleAssignmentName"> The name of the role assignment to create. It can be any valid GUID. </par |
| | 198 | | /// <param name="parameters"> Parameters for the role assignment. </param> |
| | 199 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 200 | | /// <exception cref="ArgumentNullException"> <paramref name="vaultBaseUrl"/>, <paramref name="scope"/>, <paramre |
| | 201 | | public Response<RoleAssignment> Create(string vaultBaseUrl, string scope, string roleAssignmentName, RoleAssignm |
| | 202 | | { |
| 14 | 203 | | if (vaultBaseUrl == null) |
| | 204 | | { |
| 0 | 205 | | throw new ArgumentNullException(nameof(vaultBaseUrl)); |
| | 206 | | } |
| 14 | 207 | | if (scope == null) |
| | 208 | | { |
| 0 | 209 | | throw new ArgumentNullException(nameof(scope)); |
| | 210 | | } |
| 14 | 211 | | if (roleAssignmentName == null) |
| | 212 | | { |
| 0 | 213 | | throw new ArgumentNullException(nameof(roleAssignmentName)); |
| | 214 | | } |
| 14 | 215 | | if (parameters == null) |
| | 216 | | { |
| 0 | 217 | | throw new ArgumentNullException(nameof(parameters)); |
| | 218 | | } |
| | 219 | |
|
| 14 | 220 | | using var message = CreateCreateRequest(vaultBaseUrl, scope, roleAssignmentName, parameters); |
| 14 | 221 | | _pipeline.Send(message, cancellationToken); |
| 14 | 222 | | switch (message.Response.Status) |
| | 223 | | { |
| | 224 | | case 201: |
| | 225 | | { |
| | 226 | | RoleAssignment value = default; |
| 14 | 227 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 14 | 228 | | value = RoleAssignment.DeserializeRoleAssignment(document.RootElement); |
| 14 | 229 | | return Response.FromValue(value, message.Response); |
| | 230 | | } |
| | 231 | | default: |
| 0 | 232 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 233 | | } |
| 14 | 234 | | } |
| | 235 | |
|
| | 236 | | internal HttpMessage CreateGetRequest(string vaultBaseUrl, string scope, string roleAssignmentName) |
| | 237 | | { |
| 12 | 238 | | var message = _pipeline.CreateMessage(); |
| 12 | 239 | | var request = message.Request; |
| 12 | 240 | | request.Method = RequestMethod.Get; |
| 12 | 241 | | var uri = new RawRequestUriBuilder(); |
| 12 | 242 | | uri.AppendRaw(vaultBaseUrl, false); |
| 12 | 243 | | uri.AppendPath("/", false); |
| 12 | 244 | | uri.AppendPath(scope, false); |
| 12 | 245 | | uri.AppendPath("/providers/Microsoft.Authorization/roleAssignments/", false); |
| 12 | 246 | | uri.AppendPath(roleAssignmentName, true); |
| 12 | 247 | | uri.AppendQuery("api-version", apiVersion, true); |
| 12 | 248 | | request.Uri = uri; |
| 12 | 249 | | return message; |
| | 250 | | } |
| | 251 | |
|
| | 252 | | /// <summary> Get the specified role assignment. </summary> |
| | 253 | | /// <param name="vaultBaseUrl"> The vault name, for example https://myvault.vault.azure.net. </param> |
| | 254 | | /// <param name="scope"> The scope of the role assignment. </param> |
| | 255 | | /// <param name="roleAssignmentName"> The name of the role assignment to get. </param> |
| | 256 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 257 | | /// <exception cref="ArgumentNullException"> <paramref name="vaultBaseUrl"/>, <paramref name="scope"/>, or <para |
| | 258 | | public async Task<Response<RoleAssignment>> GetAsync(string vaultBaseUrl, string scope, string roleAssignmentNam |
| | 259 | | { |
| 4 | 260 | | if (vaultBaseUrl == null) |
| | 261 | | { |
| 0 | 262 | | throw new ArgumentNullException(nameof(vaultBaseUrl)); |
| | 263 | | } |
| 4 | 264 | | if (scope == null) |
| | 265 | | { |
| 0 | 266 | | throw new ArgumentNullException(nameof(scope)); |
| | 267 | | } |
| 4 | 268 | | if (roleAssignmentName == null) |
| | 269 | | { |
| 0 | 270 | | throw new ArgumentNullException(nameof(roleAssignmentName)); |
| | 271 | | } |
| | 272 | |
|
| 4 | 273 | | using var message = CreateGetRequest(vaultBaseUrl, scope, roleAssignmentName); |
| 4 | 274 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 4 | 275 | | switch (message.Response.Status) |
| | 276 | | { |
| | 277 | | case 200: |
| | 278 | | { |
| | 279 | | RoleAssignment value = default; |
| 4 | 280 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 4 | 281 | | value = RoleAssignment.DeserializeRoleAssignment(document.RootElement); |
| 4 | 282 | | return Response.FromValue(value, message.Response); |
| | 283 | | } |
| | 284 | | default: |
| 0 | 285 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 286 | | } |
| 4 | 287 | | } |
| | 288 | |
|
| | 289 | | /// <summary> Get the specified role assignment. </summary> |
| | 290 | | /// <param name="vaultBaseUrl"> The vault name, for example https://myvault.vault.azure.net. </param> |
| | 291 | | /// <param name="scope"> The scope of the role assignment. </param> |
| | 292 | | /// <param name="roleAssignmentName"> The name of the role assignment to get. </param> |
| | 293 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 294 | | /// <exception cref="ArgumentNullException"> <paramref name="vaultBaseUrl"/>, <paramref name="scope"/>, or <para |
| | 295 | | public Response<RoleAssignment> Get(string vaultBaseUrl, string scope, string roleAssignmentName, CancellationTo |
| | 296 | | { |
| 8 | 297 | | if (vaultBaseUrl == null) |
| | 298 | | { |
| 0 | 299 | | throw new ArgumentNullException(nameof(vaultBaseUrl)); |
| | 300 | | } |
| 8 | 301 | | if (scope == null) |
| | 302 | | { |
| 0 | 303 | | throw new ArgumentNullException(nameof(scope)); |
| | 304 | | } |
| 8 | 305 | | if (roleAssignmentName == null) |
| | 306 | | { |
| 0 | 307 | | throw new ArgumentNullException(nameof(roleAssignmentName)); |
| | 308 | | } |
| | 309 | |
|
| 8 | 310 | | using var message = CreateGetRequest(vaultBaseUrl, scope, roleAssignmentName); |
| 8 | 311 | | _pipeline.Send(message, cancellationToken); |
| 8 | 312 | | switch (message.Response.Status) |
| | 313 | | { |
| | 314 | | case 200: |
| | 315 | | { |
| | 316 | | RoleAssignment value = default; |
| 6 | 317 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 6 | 318 | | value = RoleAssignment.DeserializeRoleAssignment(document.RootElement); |
| 6 | 319 | | return Response.FromValue(value, message.Response); |
| | 320 | | } |
| | 321 | | default: |
| 2 | 322 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 323 | | } |
| 6 | 324 | | } |
| | 325 | |
|
| | 326 | | internal HttpMessage CreateListForScopeRequest(string vaultBaseUrl, string scope, string filter) |
| | 327 | | { |
| 6 | 328 | | var message = _pipeline.CreateMessage(); |
| 6 | 329 | | var request = message.Request; |
| 6 | 330 | | request.Method = RequestMethod.Get; |
| 6 | 331 | | var uri = new RawRequestUriBuilder(); |
| 6 | 332 | | uri.AppendRaw(vaultBaseUrl, false); |
| 6 | 333 | | uri.AppendPath("/", false); |
| 6 | 334 | | uri.AppendPath(scope, false); |
| 6 | 335 | | uri.AppendPath("/providers/Microsoft.Authorization/roleAssignments", false); |
| 6 | 336 | | if (filter != null) |
| | 337 | | { |
| 0 | 338 | | uri.AppendQuery("$filter", filter, true); |
| | 339 | | } |
| 6 | 340 | | uri.AppendQuery("api-version", apiVersion, true); |
| 6 | 341 | | request.Uri = uri; |
| 6 | 342 | | return message; |
| | 343 | | } |
| | 344 | |
|
| | 345 | | /// <summary> Gets role assignments for a scope. </summary> |
| | 346 | | /// <param name="vaultBaseUrl"> The vault name, for example https://myvault.vault.azure.net. </param> |
| | 347 | | /// <param name="scope"> The scope of the role assignments. </param> |
| | 348 | | /// <param name="filter"> The filter to apply on the operation. Use $filter=atScope() to return all role assignm |
| | 349 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 350 | | /// <exception cref="ArgumentNullException"> <paramref name="vaultBaseUrl"/> or <paramref name="scope"/> is null |
| | 351 | | public async Task<Response<RoleAssignmentListResult>> ListForScopeAsync(string vaultBaseUrl, string scope, strin |
| | 352 | | { |
| 2 | 353 | | if (vaultBaseUrl == null) |
| | 354 | | { |
| 0 | 355 | | throw new ArgumentNullException(nameof(vaultBaseUrl)); |
| | 356 | | } |
| 2 | 357 | | if (scope == null) |
| | 358 | | { |
| 0 | 359 | | throw new ArgumentNullException(nameof(scope)); |
| | 360 | | } |
| | 361 | |
|
| 2 | 362 | | using var message = CreateListForScopeRequest(vaultBaseUrl, scope, filter); |
| 2 | 363 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 2 | 364 | | switch (message.Response.Status) |
| | 365 | | { |
| | 366 | | case 200: |
| | 367 | | { |
| | 368 | | RoleAssignmentListResult value = default; |
| 2 | 369 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 2 | 370 | | value = RoleAssignmentListResult.DeserializeRoleAssignmentListResult(document.RootElement); |
| 2 | 371 | | return Response.FromValue(value, message.Response); |
| | 372 | | } |
| | 373 | | default: |
| 0 | 374 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 375 | | } |
| 2 | 376 | | } |
| | 377 | |
|
| | 378 | | /// <summary> Gets role assignments for a scope. </summary> |
| | 379 | | /// <param name="vaultBaseUrl"> The vault name, for example https://myvault.vault.azure.net. </param> |
| | 380 | | /// <param name="scope"> The scope of the role assignments. </param> |
| | 381 | | /// <param name="filter"> The filter to apply on the operation. Use $filter=atScope() to return all role assignm |
| | 382 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 383 | | /// <exception cref="ArgumentNullException"> <paramref name="vaultBaseUrl"/> or <paramref name="scope"/> is null |
| | 384 | | public Response<RoleAssignmentListResult> ListForScope(string vaultBaseUrl, string scope, string filter = null, |
| | 385 | | { |
| 4 | 386 | | if (vaultBaseUrl == null) |
| | 387 | | { |
| 0 | 388 | | throw new ArgumentNullException(nameof(vaultBaseUrl)); |
| | 389 | | } |
| 4 | 390 | | if (scope == null) |
| | 391 | | { |
| 0 | 392 | | throw new ArgumentNullException(nameof(scope)); |
| | 393 | | } |
| | 394 | |
|
| 4 | 395 | | using var message = CreateListForScopeRequest(vaultBaseUrl, scope, filter); |
| 4 | 396 | | _pipeline.Send(message, cancellationToken); |
| 4 | 397 | | switch (message.Response.Status) |
| | 398 | | { |
| | 399 | | case 200: |
| | 400 | | { |
| | 401 | | RoleAssignmentListResult value = default; |
| 4 | 402 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 4 | 403 | | value = RoleAssignmentListResult.DeserializeRoleAssignmentListResult(document.RootElement); |
| 4 | 404 | | return Response.FromValue(value, message.Response); |
| | 405 | | } |
| | 406 | | default: |
| 0 | 407 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 408 | | } |
| 4 | 409 | | } |
| | 410 | |
|
| | 411 | | internal HttpMessage CreateListForScopeNextPageRequest(string nextLink, string vaultBaseUrl, string scope, strin |
| | 412 | | { |
| 0 | 413 | | var message = _pipeline.CreateMessage(); |
| 0 | 414 | | var request = message.Request; |
| 0 | 415 | | request.Method = RequestMethod.Get; |
| 0 | 416 | | var uri = new RawRequestUriBuilder(); |
| 0 | 417 | | uri.AppendRaw(vaultBaseUrl, false); |
| 0 | 418 | | uri.AppendRawNextLink(nextLink, false); |
| 0 | 419 | | request.Uri = uri; |
| 0 | 420 | | return message; |
| | 421 | | } |
| | 422 | |
|
| | 423 | | /// <summary> Gets role assignments for a scope. </summary> |
| | 424 | | /// <param name="nextLink"> The URL to the next page of results. </param> |
| | 425 | | /// <param name="vaultBaseUrl"> The vault name, for example https://myvault.vault.azure.net. </param> |
| | 426 | | /// <param name="scope"> The scope of the role assignments. </param> |
| | 427 | | /// <param name="filter"> The filter to apply on the operation. Use $filter=atScope() to return all role assignm |
| | 428 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 429 | | /// <exception cref="ArgumentNullException"> <paramref name="nextLink"/>, <paramref name="vaultBaseUrl"/>, or <p |
| | 430 | | public async Task<Response<RoleAssignmentListResult>> ListForScopeNextPageAsync(string nextLink, string vaultBas |
| | 431 | | { |
| 0 | 432 | | if (nextLink == null) |
| | 433 | | { |
| 0 | 434 | | throw new ArgumentNullException(nameof(nextLink)); |
| | 435 | | } |
| 0 | 436 | | if (vaultBaseUrl == null) |
| | 437 | | { |
| 0 | 438 | | throw new ArgumentNullException(nameof(vaultBaseUrl)); |
| | 439 | | } |
| 0 | 440 | | if (scope == null) |
| | 441 | | { |
| 0 | 442 | | throw new ArgumentNullException(nameof(scope)); |
| | 443 | | } |
| | 444 | |
|
| 0 | 445 | | using var message = CreateListForScopeNextPageRequest(nextLink, vaultBaseUrl, scope, filter); |
| 0 | 446 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 447 | | switch (message.Response.Status) |
| | 448 | | { |
| | 449 | | case 200: |
| | 450 | | { |
| | 451 | | RoleAssignmentListResult value = default; |
| 0 | 452 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 0 | 453 | | value = RoleAssignmentListResult.DeserializeRoleAssignmentListResult(document.RootElement); |
| 0 | 454 | | return Response.FromValue(value, message.Response); |
| | 455 | | } |
| | 456 | | default: |
| 0 | 457 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 458 | | } |
| 0 | 459 | | } |
| | 460 | |
|
| | 461 | | /// <summary> Gets role assignments for a scope. </summary> |
| | 462 | | /// <param name="nextLink"> The URL to the next page of results. </param> |
| | 463 | | /// <param name="vaultBaseUrl"> The vault name, for example https://myvault.vault.azure.net. </param> |
| | 464 | | /// <param name="scope"> The scope of the role assignments. </param> |
| | 465 | | /// <param name="filter"> The filter to apply on the operation. Use $filter=atScope() to return all role assignm |
| | 466 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 467 | | /// <exception cref="ArgumentNullException"> <paramref name="nextLink"/>, <paramref name="vaultBaseUrl"/>, or <p |
| | 468 | | public Response<RoleAssignmentListResult> ListForScopeNextPage(string nextLink, string vaultBaseUrl, string scop |
| | 469 | | { |
| 0 | 470 | | if (nextLink == null) |
| | 471 | | { |
| 0 | 472 | | throw new ArgumentNullException(nameof(nextLink)); |
| | 473 | | } |
| 0 | 474 | | if (vaultBaseUrl == null) |
| | 475 | | { |
| 0 | 476 | | throw new ArgumentNullException(nameof(vaultBaseUrl)); |
| | 477 | | } |
| 0 | 478 | | if (scope == null) |
| | 479 | | { |
| 0 | 480 | | throw new ArgumentNullException(nameof(scope)); |
| | 481 | | } |
| | 482 | |
|
| 0 | 483 | | using var message = CreateListForScopeNextPageRequest(nextLink, vaultBaseUrl, scope, filter); |
| 0 | 484 | | _pipeline.Send(message, cancellationToken); |
| 0 | 485 | | switch (message.Response.Status) |
| | 486 | | { |
| | 487 | | case 200: |
| | 488 | | { |
| | 489 | | RoleAssignmentListResult value = default; |
| 0 | 490 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 0 | 491 | | value = RoleAssignmentListResult.DeserializeRoleAssignmentListResult(document.RootElement); |
| 0 | 492 | | return Response.FromValue(value, message.Response); |
| | 493 | | } |
| | 494 | | default: |
| 0 | 495 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 496 | | } |
| 0 | 497 | | } |
| | 498 | | } |
| | 499 | | } |