Documentation
¶
Index ¶
- func NewOpenAuthClientV1(ctx context.Context, config *ClientConfig) (openauth_v1.OpenAuthClient, *grpc.ClientConn, error)
- type ClientConfig
- type ConfigFetcher
- type ConfigReader
- type OpenauthConfigFetcher
- func (c *OpenauthConfigFetcher) Close() error
- func (c *OpenauthConfigFetcher) GetConfigsByEntityName(ctx context.Context, entityName string) (*openauth_v1.ListConfigsResponse, error)
- func (c *OpenauthConfigFetcher) GetConfigsByKeys(ctx context.Context, in *openauth_v1.GetConfigsByKeysRequest) (*openauth_v1.GetConfigsByKeysResponse, error)
- func (c *OpenauthConfigFetcher) Logout(ctx context.Context, req *openauth_v1.LogoutRequest) (*openauth_v1.LogoutResponse, error)
- func (c *OpenauthConfigFetcher) RefreshToken(ctx context.Context, req *openauth_v1.RefreshTokenRequest) (*openauth_v1.RefreshTokenResponse, error)
- func (c *OpenauthConfigFetcher) SignIn(ctx context.Context, req *openauth_v1.SignInRequest) (*openauth_v1.SignInResponse, error)
- type ReadOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewOpenAuthClientV1 ¶ added in v1.0.2
func NewOpenAuthClientV1(ctx context.Context, config *ClientConfig) (openauth_v1.OpenAuthClient, *grpc.ClientConn, error)
Types ¶
type ClientConfig ¶
type ConfigFetcher ¶
type ConfigFetcher interface {
GetConfigsByKeys(ctx context.Context, in *openauth_v1.GetConfigsByKeysRequest) (*openauth_v1.GetConfigsByKeysResponse, error)
}
type ConfigReader ¶
type ConfigReader struct {
// contains filtered or unexported fields
}
func NewConfigReader ¶
func NewConfigReader(fetcher ConfigFetcher, options ...ReadOptions) *ConfigReader
func NewOpenAuthConfigReader ¶
func NewOpenAuthConfigReader(cfg *ClientConfig, options ...ReadOptions) *ConfigReader
func (*ConfigReader) ReadConfig ¶
func (r *ConfigReader) ReadConfig(ctx context.Context, cfg any) error
reads configuration into the provided cfg structure based on its tags cfg should be a pointer to a struct with appropriate tags Example:
type MyConfig struct {
Key string `entity:"openauth" key:"key"`
Value string `entity:"openauth" key:"value"`
}
myConfig := &MyConfig{} err := configReader.Read(ctx, myConfig) This will populate myConfig.Key and myConfig.Value with the corresponding config values
type OpenauthConfigFetcher ¶ added in v1.0.2
type OpenauthConfigFetcher struct {
// contains filtered or unexported fields
}
func NewOpenauthConfigFetcher ¶ added in v1.0.2
func NewOpenauthConfigFetcher(ctx context.Context, config *ClientConfig) (*OpenauthConfigFetcher, error)
func (*OpenauthConfigFetcher) Close ¶ added in v1.0.2
func (c *OpenauthConfigFetcher) Close() error
Close closes the gRPC connection
func (*OpenauthConfigFetcher) GetConfigsByEntityName ¶ added in v1.0.2
func (c *OpenauthConfigFetcher) GetConfigsByEntityName(ctx context.Context, entityName string) (*openauth_v1.ListConfigsResponse, error)
func (*OpenauthConfigFetcher) GetConfigsByKeys ¶ added in v1.0.2
func (c *OpenauthConfigFetcher) GetConfigsByKeys(ctx context.Context, in *openauth_v1.GetConfigsByKeysRequest) (*openauth_v1.GetConfigsByKeysResponse, error)
func (*OpenauthConfigFetcher) Logout ¶ added in v1.0.2
func (c *OpenauthConfigFetcher) Logout(ctx context.Context, req *openauth_v1.LogoutRequest) (*openauth_v1.LogoutResponse, error)
func (*OpenauthConfigFetcher) RefreshToken ¶ added in v1.0.2
func (c *OpenauthConfigFetcher) RefreshToken(ctx context.Context, req *openauth_v1.RefreshTokenRequest) (*openauth_v1.RefreshTokenResponse, error)
func (*OpenauthConfigFetcher) SignIn ¶ added in v1.0.2
func (c *OpenauthConfigFetcher) SignIn(ctx context.Context, req *openauth_v1.SignInRequest) (*openauth_v1.SignInResponse, error)
type ReadOptions ¶
type ReadOptions struct {
Watch bool // if true, will watch for config changes and update cfg accordingly
DelayDuration time.Duration // duration between each watch check, default is 1 minute
OnChange func(entity, key string, oldValue, newValue any) // callback function invoked when a config value changes
}
Click to show internal directories.
Click to hide internal directories.