Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Directory Client #7

Merged
merged 6 commits into from
Oct 16, 2023
Merged

Directory Client #7

merged 6 commits into from
Oct 16, 2023

Conversation

ronenh
Copy link
Contributor

@ronenh ronenh commented Oct 11, 2023

This PR introduces a client/directory package with the following types:

directory.Client: A struct with Reader, Writer, Importer, and Exporter fields.
directory.Config: Configuration for constructing a directory client.

A directory client can be created in a similar way as authorizer clients:

dir, err := directory.New(ctx, client.WithTenantID("..."), client.WithAPIKeyAuth("..."))

Config can be used to create a directory client with customized configuration for each service:

cfg := &directory.Config{
    Reader: &client.Config{Address: "localhost:9292"},
    Writer: &client.Config{Address: "localhost:9293"},
}
dir, err := cfg.Connect(ctx)

In this case, dir.Reader and dir.Writer are initialized with the given configuration. dir.Importer and dir.Exporter are nil.

It's also possible to provide fallback configuration that is used unless overridden:

cfg := &directory.Config{
    Config: &client.Config{Address: "directory.prod.aserto.com:8443", TenantID: "???"},
    Reader: &client.Config{Address: "localhost:9292"},
}

dir, err := cfg.Connect(ctx)

In this case, all services connect to the hosted directory, except reader which connects to localhost.

@ronenh ronenh force-pushed the directory-client branch 2 times, most recently from a7c569d to e53ba36 Compare October 13, 2023 21:42
@gertd gertd merged commit 11d6408 into main Oct 16, 2023
3 checks passed
@gertd gertd deleted the directory-client branch October 16, 2023 16:58
gertd added a commit that referenced this pull request Oct 17, 2023
* Directory Client (#7)

* Add directory client

* update readme

* Move directory client to /v2

* Update linter

* move test files to _test package namespace

---------

Co-authored-by: Gert Drapers <gert.drapers@live.com>

* 2 minute timeout for lint actio (#10)

---------

Co-authored-by: Gert Drapers <gert.drapers@live.com>
ronenh added a commit that referenced this pull request Oct 31, 2023
* Directory Client (#7)

* Add directory client

* update readme

* Move directory client to /v2

* Update linter

* move test files to _test package namespace

---------

Co-authored-by: Gert Drapers <gert.drapers@live.com>

* 2 minute timeout for lint actio (#10)

---------

Co-authored-by: Gert Drapers <gert.drapers@live.com>
ronenh added a commit that referenced this pull request Oct 31, 2023
* Add directory client

* update readme

* Move directory client to /v2

* Update linter

* move test files to _test package namespace

---------

Co-authored-by: Gert Drapers <gert.drapers@live.com>
ronenh added a commit that referenced this pull request Oct 31, 2023
* Directory Client (#7)

* Add directory client

* update readme

* Move directory client to /v2

* Update linter

* move test files to _test package namespace

---------

Co-authored-by: Gert Drapers <gert.drapers@live.com>

* 2 minute timeout for lint actio (#10)

---------

Co-authored-by: Gert Drapers <gert.drapers@live.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants