Пример #1
0
        public virtual async Task <Response <SqlRoleDefinitionResource> > GetAsync(string roleDefinitionId, CancellationToken cancellationToken = default)
        {
            Argument.AssertNotNullOrEmpty(roleDefinitionId, nameof(roleDefinitionId));

            using var scope = _sqlRoleDefinitionSqlResourcesClientDiagnostics.CreateScope("SqlRoleDefinitionCollection.Get");
            scope.Start();
            try
            {
                var response = await _sqlRoleDefinitionSqlResourcesRestClient.GetSqlRoleDefinitionAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, roleDefinitionId, cancellationToken).ConfigureAwait(false);

                if (response.Value == null)
                {
                    throw new RequestFailedException(response.GetRawResponse());
                }
                return(Response.FromValue(new SqlRoleDefinitionResource(Client, response.Value), response.GetRawResponse()));
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }