AccessProviders

AccessProviders( [database] )
AccessProviders( )
ScopedAccessProviders( [database] )
AccessProviders( [database] )
AccessProviders( [database] )
access_providers( [database] )
AccessProviders( [database] )

Description

The AccessProviders function, when executed with Paginate, returns the set of References for all AccessProviders in the specified child database. If a child database is not specified, the returned index references all belong to the current database.

When a child database is specified, an admin key must be used to call AccessProviders (server or client keys, or ABAC tokens, cannot be used to access a child database).

Also, Go does not support optional function parameters, nor function overloading. To specify a child database using the Go driver, call the ScopedAccessProviders function instead of AccessProviders.

Parameters

Parameter Type Definition and Requirements

database

Optional - A Reference to a child database. If not specified, the current database is used.

A Reference to a child database.

Optional - A Reference to a child database. If not specified, the current database is used.

Optional - A Reference to a child database. If not specified, the current database is used.

Optional - A Reference to a child database. If not specified, the current database is used.

Optional - A Reference to a child database. If not specified, the current database is used.

Optional - A Reference to a child database. If not specified, the current database is used.

Returns

A Set Reference for the available AccessProviders in the specified child database (or the current database if database is not specified).

Examples

  1. The following query gets the references to all AccessProviders in the current database:

    try
    {
        Value result = await client.Query(
            Paginate(AccessProviders())
        );
    
        Console.WriteLine(result);
    }
    catch (Exception e)
    {
        Console.WriteLine($"ERROR: {e.Message}");
    }
    ObjectV(data: Arr(RefV(id = "Auth0-myapp", collection = RefV(id = "access_providers"))))
    result, err := client.Query(
    	f.Paginate(f.AccessProviders()))
    
    if err != nil {
    	fmt.Fprintln(os.Stderr, err)
    } else {
    	fmt.Println(result)
    }
    map[data:[{Auth0-myapp 0xc0001084e0 0xc0001084e0 <nil>}]]
    System.out.println(
        client.query(
            Paginate(AccessProviders())
        ).get());
    {data: [ref(id = "Auth0-myapp", collection = ref(id = "access_providers"))]}
    client.query(
      q.Paginate(q.AccessProviders())
    )
    .then((ret) => console.log(ret))
    .catch((err) => console.error(
      'Error: [%s] %s: %s',
      err.name,
      err.message,
      err.errors()[0].description,
    ))
    { data: [ AccessProvider("Auth0-myapp") ] }
    result = client.query(
        q.paginate(q.access_providers())
    )
    print(result)
    {'data': [Ref(id=Auth0-myapp, collection=Ref(id=access_providers))]}
    Paginate(AccessProviders())
    { data: [ AccessProvider("Auth0-myapp") ] }
    Query metrics:
    •    bytesIn:  38

    •   bytesOut: 101

    • computeOps:   1

    •    readOps:   8

    •   writeOps:   0

    •  readBytes: 250

    • writeBytes:   0

    •  queryTime: 8ms

    •    retries:   0

  2. The following query demonstrates what happens when no AccessProviders exist:

    try
    {
        Value result = await client.Query(
            Paginate(AccessProviders())
        );
    
        Console.WriteLine(result);
    }
    catch (Exception e)
    {
        Console.WriteLine($"ERROR: {e.Message}");
    }
    ObjectV(data: Arr())
    result, err := client.Query(
    	f.Paginate(f.AccessProviders()))
    
    if err != nil {
    	fmt.Fprintln(os.Stderr, err)
    } else {
    	fmt.Println(result)
    }
    map[data:[]]
    System.out.println(
        client.query(
            Paginate(AccessProviders())
        ).get());
    {data: []}
    client.query(
      q.Paginate(q.AccessProviders())
    )
    .then((ret) => console.log(ret))
    .catch((err) => console.error(
      'Error: [%s] %s: %s',
      err.name,
      err.message,
      err.errors()[0].description,
    ))
    { data: [] }
    result = client.query(
        q.paginate(q.access_providers())
    )
    print(result)
    {'data': []}
    Paginate(AccessProviders())
    { data: [] }
    Query metrics:
    •    bytesIn:    38

    •   bytesOut:    24

    • computeOps:     1

    •    readOps:     8

    •   writeOps:     0

    •  readBytes:   208

    • writeBytes:     0

    •  queryTime: 378ms

    •    retries:     0

  3. The following query lists the References for any AccessProviders (up to the pagination limit) within a child database named "child_db":

    try
    {
        Value result = await client.Query(
            Paginate(AccessProviders(Database("child_db")))
        );
    
        Console.WriteLine(result);
    }
    catch (Exception e)
    {
        Console.WriteLine($"ERROR: {e.Message}");
    }
    ObjectV(data: Arr())
    result, err := client.Query(
    	f.Paginate(f.ScopedAccessProviders(f.Database("child_db"))))
    
    if err != nil {
    	fmt.Fprintln(os.Stderr, err)
    } else {
    	fmt.Println(result)
    }
    map[data:[]]
    System.out.println(
        client.query(
            Paginate(AccessProviders(Database("child_db")))
        ).get());
    {data: []}
    client.query(
      q.Paginate(q.AccessProviders(q.Database('child_db')))
    )
    .then((ret) => console.log(ret))
    .catch((err) => console.error(
      'Error: [%s] %s: %s',
      err.name,
      err.message,
      err.errors()[0].description,
    ))
    { data: [] }
    result = client.query(
        q.paginate(q.access_providers(q.database("child_db")))
    )
    print(result)
    {'data': []}
    Paginate(AccessProviders(Database("child_db")))
    { data: [] }
    Query metrics:
    •    bytesIn:   57

    •   bytesOut:   24

    • computeOps:    1

    •    readOps:    8

    •   writeOps:    0

    •  readBytes:  382

    • writeBytes:    0

    •  queryTime: 21ms

    •    retries:    0

Was this article helpful? 

We're sorry to hear that.
Tell us how we can improve!
Visit Fauna's forums or email docs@fauna.com

Thank you for your feedback!