Beispiel #1
0
        public async Task <Response <CheckPrincipalAccessResponse> > CheckPrincipalAccessAsync(SubjectInfo subject, IEnumerable <RequiredAction> actions, string scope, CancellationToken cancellationToken = default)
        {
            if (subject == null)
            {
                throw new ArgumentNullException(nameof(subject));
            }
            if (actions == null)
            {
                throw new ArgumentNullException(nameof(actions));
            }
            if (scope == null)
            {
                throw new ArgumentNullException(nameof(scope));
            }

            using var message = CreateCheckPrincipalAccessRequest(subject, actions, scope);
            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);

            switch (message.Response.Status)
            {
            case 200:
            {
                CheckPrincipalAccessResponse value = default;
                using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);

                value = CheckPrincipalAccessResponse.DeserializeCheckPrincipalAccessResponse(document.RootElement);
                return(Response.FromValue(value, message.Response));
            }
 public virtual async Task <Response <CheckPrincipalAccessResponse> > CheckPrincipalAccessAsync(SubjectInfo subject, IEnumerable <RequiredAction> actions, string scope, CancellationToken cancellationToken = default)
 {
     using var scope0 = _clientDiagnostics.CreateScope("RoleAssignmentsClient.CheckPrincipalAccess");
     scope0.Start();
     try
     {
         return(await RestClient.CheckPrincipalAccessAsync(subject, actions, scope, cancellationToken).ConfigureAwait(false));
     }
     catch (Exception e)
     {
         scope0.Failed(e);
         throw;
     }
 }