Esempio n. 1
0
        public virtual Response <SqlRoleDefinitionResource> Get(string roleDefinitionId, CancellationToken cancellationToken = default)
        {
            Argument.AssertNotNullOrEmpty(roleDefinitionId, nameof(roleDefinitionId));

            using var scope = _sqlRoleDefinitionSqlResourcesClientDiagnostics.CreateScope("SqlRoleDefinitionCollection.Get");
            scope.Start();
            try
            {
                var response = _sqlRoleDefinitionSqlResourcesRestClient.GetSqlRoleDefinition(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, roleDefinitionId, cancellationToken);
                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;
            }
        }