public async Task <Response <RoleAssignmentDetails> > CreateRoleAssignmentAsync(RoleAssignmentOptions createRoleAssignmentOptions, CancellationToken cancellationToken = default) { if (createRoleAssignmentOptions == null) { throw new ArgumentNullException(nameof(createRoleAssignmentOptions)); } using var message = CreateCreateRoleAssignmentRequest(createRoleAssignmentOptions); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: { RoleAssignmentDetails value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); if (document.RootElement.ValueKind == JsonValueKind.Null) { value = null; } else { value = RoleAssignmentDetails.DeserializeRoleAssignmentDetails(document.RootElement); } return(Response.FromValue(value, message.Response)); }
internal static CheckAccessDecision DeserializeCheckAccessDecision(JsonElement element) { Optional <string> accessDecision = default; Optional <string> actionId = default; Optional <RoleAssignmentDetails> roleAssignment = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("accessDecision")) { accessDecision = property.Value.GetString(); continue; } if (property.NameEquals("actionId")) { actionId = property.Value.GetString(); continue; } if (property.NameEquals("roleAssignment")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } roleAssignment = RoleAssignmentDetails.DeserializeRoleAssignmentDetails(property.Value); continue; } } return(new CheckAccessDecision(accessDecision.Value, actionId.Value, roleAssignment.Value)); }
public static CheckAccessDecision CheckAccessDecision(string accessDecision = default, string actionId = default, RoleAssignmentDetails roleAssignment = default) { return(new CheckAccessDecision(accessDecision, actionId, roleAssignment)); }