Documentation ¶
Overview ¶
Package sdk is the official Flipt Go SDK.
The SDK exposes the various RPC for interfacing with a remote Flipt instance. Both HTTP and gRPC protocols are supported via this unified Go API.
The main entrypoint within this package is New, which takes an instance of Transport and returns an instance of SDK. Transport implementations can be found in the following sub-packages:
GRPC Transport ¶
The following is an example of creating and instance of the SDK using the gRPC transport.
func main() { conn := grpc.Dial("localhost:9090") transport := grpc.NewTransport(conn) client := sdk.New(transport) }
HTTP Transport ¶
The following is an example of creating an instance of the SDK using the HTTP transport.
func main() { transport := http.NewTransport("http://localhost:8080") client := sdk.New(transport) }
Authenticating the SDK ¶
The remote procedure calls mades by this SDK are authenticated via a ClientAuthenticationProvider implementation. This can be supplied to New via the WithAuthenticationProvider option. Note that each of these methods will only work if the target Flipt server instance has the authentication method enabled.
Currently, there are three implementations:
- StaticTokenAuthenticationProvider(https://www.flipt.io/docs/authentication/methods#static-token):
This provider sets a static Flipt client token via the Authentication header with the Bearer scheme.
func main() { provider := sdk.StaticTokenAuthenticationProvider("some-flipt-token") client := sdk.New(transport, sdk.WithAuthenticationProvider(provider)) }
- JWTAuthenticationProvider(https://www.flipt.io/docs/authentication/methods#json-web-tokens):
This provider sets a pre-generated JSON web-token via the Authentication header with the JWT scheme.
func main() { provider := sdk.JWTAuthenticationProvider("some-flipt-jwt") client := sdk.New(transport, sdk.WithAuthenticationProvider(provider)) }
- KubernetesAuthenticationProvider(https://www.flipt.io/docs/authentication/methods#kubernetes):
This automatically uses the service account token on the host and exchanges it with Flipt for a Flipt client token credential. The credential is then used to authenticate requests, again via the Authentication header and the Bearer scheme. It ensures that the client token is not-expired and requests fresh tokens automatically without intervention. Use this method to automatically authenticate your application with a Flipt deployed into the same Kubernetes cluster.
func main() { provider := sdk.NewKuberntesAuthenticationProvider(transport) client := sdk.New(transport, sdk.WithAuthenticationProvider(provider)) }
SDK Services ¶
The Flipt SDK is split into four sections Flipt, Auth, Meta, and Evaluation. Each of which provides access to different parts of the Flipt system.
Flipt Service ¶
The Flipt service is the core Flipt API service. This service provides access to the Flipt resource CRUD APIs.
client := sdk.New(transport).Flipt()
Flipt resources can be accessed and managed directly.
flag, err := client.GetFlag(ctx, &flipt.GetFlagRequest{ NamespaceKey: "my_namespace", Key: "my_flag_key", }) if err != nil { panic(err) } fmt.Println(flag.Name) fmt.Println(flag.Description)
Evaluation Service ¶
The Evaluation service provides access to the Flipt evaluation APIs.
client := sdk.New(transport).Evaluation()
The Evaluation service provides three methods for evaluating a flag for a given entity: Boolean, Variant, and Batch.
Boolean ¶
The Boolean method returns a response containing a boolean value indicating whether or not the flag is enabled for the given entity. Learn more about the Boolean flag type: <https://www.flipt.io/docs/concepts#boolean-flags>
resp, err := client.Boolean(ctx, &evaluation.EvaluationRequest{ NamespaceKey: "my_namespace", FlagKey: "my_flag_key", EntityId: "my_entity_id", }) if err != nil { panic(err) } fmt.Println(resp.Enabled)
Variant ¶
The Variant method returns a response containing the variant key for the given entity. Learn more about the Variant flag type: <https://www.flipt.io/docs/concepts#variant-flags>
resp, err := client.Variant(ctx, &evaluation.EvaluationRequest{ NamespaceKey: "my_namespace", FlagKey: "my_flag_key", EntityId: "my_entity_id", }) if err != nil { panic(err) } fmt.Println(resp.VariantKey) fmt.Println(resp.VariantAttachment) Optional
Batch ¶
The Batch method returns a response containing the evaluation results for a batch of requests. These requests can be for a mix of boolean and variant flags.
resp, err := client.Batch(ctx, &evaluation.BatchRequest{ RequestId: "my_request_id", Requests: []*evaluation.EvaluationRequest{ { NamespaceKey: "my_namespace", FlagKey: "my_flag_key", EntityId: "my_entity_id", } }, }) if err != nil { panic(err) } for _, result := range resp.Responses { fmt.Println(result.Type) }
Index ¶
- Constants
- type Analytics
- type Auth
- func (s Auth) AuthenticationMethodGithubService() *AuthenticationMethodGithubService
- func (s Auth) AuthenticationMethodKubernetesService() *AuthenticationMethodKubernetesService
- func (s Auth) AuthenticationMethodOIDCService() *AuthenticationMethodOIDCService
- func (s Auth) AuthenticationMethodTokenService() *AuthenticationMethodTokenService
- func (s Auth) AuthenticationService() *AuthenticationService
- func (s Auth) PublicAuthenticationService() *PublicAuthenticationService
- type AuthClient
- type AuthenticationMethodGithubService
- type AuthenticationMethodKubernetesService
- type AuthenticationMethodOIDCService
- type AuthenticationMethodTokenService
- type AuthenticationService
- func (x *AuthenticationService) DeleteAuthentication(ctx context.Context, v *auth.DeleteAuthenticationRequest) error
- func (x *AuthenticationService) ExpireAuthenticationSelf(ctx context.Context, v *auth.ExpireAuthenticationSelfRequest) error
- func (x *AuthenticationService) GetAuthentication(ctx context.Context, v *auth.GetAuthenticationRequest) (*auth.Authentication, error)
- func (x *AuthenticationService) GetAuthenticationSelf(ctx context.Context) (*auth.Authentication, error)
- func (x *AuthenticationService) ListAuthentications(ctx context.Context, v *auth.ListAuthenticationsRequest) (*auth.ListAuthenticationsResponse, error)
- type ClientAuthenticationProvider
- type ClientTokenProvider
- type Evaluation
- func (x *Evaluation) Batch(ctx context.Context, v *evaluation.BatchEvaluationRequest) (*evaluation.BatchEvaluationResponse, error)
- func (x *Evaluation) Boolean(ctx context.Context, v *evaluation.EvaluationRequest) (*evaluation.BooleanEvaluationResponse, error)
- func (x *Evaluation) Variant(ctx context.Context, v *evaluation.EvaluationRequest) (*evaluation.VariantEvaluationResponse, error)
- type Flipt
- func (x *Flipt) BatchEvaluate(ctx context.Context, v *flipt.BatchEvaluationRequest) (*flipt.BatchEvaluationResponse, error)
- func (x *Flipt) CreateConstraint(ctx context.Context, v *flipt.CreateConstraintRequest) (*flipt.Constraint, error)
- func (x *Flipt) CreateDistribution(ctx context.Context, v *flipt.CreateDistributionRequest) (*flipt.Distribution, error)
- func (x *Flipt) CreateFlag(ctx context.Context, v *flipt.CreateFlagRequest) (*flipt.Flag, error)
- func (x *Flipt) CreateNamespace(ctx context.Context, v *flipt.CreateNamespaceRequest) (*flipt.Namespace, error)
- func (x *Flipt) CreateRollout(ctx context.Context, v *flipt.CreateRolloutRequest) (*flipt.Rollout, error)
- func (x *Flipt) CreateRule(ctx context.Context, v *flipt.CreateRuleRequest) (*flipt.Rule, error)
- func (x *Flipt) CreateSegment(ctx context.Context, v *flipt.CreateSegmentRequest) (*flipt.Segment, error)
- func (x *Flipt) CreateVariant(ctx context.Context, v *flipt.CreateVariantRequest) (*flipt.Variant, error)
- func (x *Flipt) DeleteConstraint(ctx context.Context, v *flipt.DeleteConstraintRequest) error
- func (x *Flipt) DeleteDistribution(ctx context.Context, v *flipt.DeleteDistributionRequest) error
- func (x *Flipt) DeleteFlag(ctx context.Context, v *flipt.DeleteFlagRequest) error
- func (x *Flipt) DeleteNamespace(ctx context.Context, v *flipt.DeleteNamespaceRequest) error
- func (x *Flipt) DeleteRollout(ctx context.Context, v *flipt.DeleteRolloutRequest) error
- func (x *Flipt) DeleteRule(ctx context.Context, v *flipt.DeleteRuleRequest) error
- func (x *Flipt) DeleteSegment(ctx context.Context, v *flipt.DeleteSegmentRequest) error
- func (x *Flipt) DeleteVariant(ctx context.Context, v *flipt.DeleteVariantRequest) error
- func (x *Flipt) Evaluate(ctx context.Context, v *flipt.EvaluationRequest) (*flipt.EvaluationResponse, error)
- func (x *Flipt) GetFlag(ctx context.Context, v *flipt.GetFlagRequest) (*flipt.Flag, error)
- func (x *Flipt) GetNamespace(ctx context.Context, v *flipt.GetNamespaceRequest) (*flipt.Namespace, error)
- func (x *Flipt) GetRollout(ctx context.Context, v *flipt.GetRolloutRequest) (*flipt.Rollout, error)
- func (x *Flipt) GetRule(ctx context.Context, v *flipt.GetRuleRequest) (*flipt.Rule, error)
- func (x *Flipt) GetSegment(ctx context.Context, v *flipt.GetSegmentRequest) (*flipt.Segment, error)
- func (x *Flipt) ListFlags(ctx context.Context, v *flipt.ListFlagRequest) (*flipt.FlagList, error)
- func (x *Flipt) ListNamespaces(ctx context.Context, v *flipt.ListNamespaceRequest) (*flipt.NamespaceList, error)
- func (x *Flipt) ListRollouts(ctx context.Context, v *flipt.ListRolloutRequest) (*flipt.RolloutList, error)
- func (x *Flipt) ListRules(ctx context.Context, v *flipt.ListRuleRequest) (*flipt.RuleList, error)
- func (x *Flipt) ListSegments(ctx context.Context, v *flipt.ListSegmentRequest) (*flipt.SegmentList, error)
- func (x *Flipt) OrderRollouts(ctx context.Context, v *flipt.OrderRolloutsRequest) error
- func (x *Flipt) OrderRules(ctx context.Context, v *flipt.OrderRulesRequest) error
- func (x *Flipt) UpdateConstraint(ctx context.Context, v *flipt.UpdateConstraintRequest) (*flipt.Constraint, error)
- func (x *Flipt) UpdateDistribution(ctx context.Context, v *flipt.UpdateDistributionRequest) (*flipt.Distribution, error)
- func (x *Flipt) UpdateFlag(ctx context.Context, v *flipt.UpdateFlagRequest) (*flipt.Flag, error)
- func (x *Flipt) UpdateNamespace(ctx context.Context, v *flipt.UpdateNamespaceRequest) (*flipt.Namespace, error)
- func (x *Flipt) UpdateRollout(ctx context.Context, v *flipt.UpdateRolloutRequest) (*flipt.Rollout, error)
- func (x *Flipt) UpdateRule(ctx context.Context, v *flipt.UpdateRuleRequest) (*flipt.Rule, error)
- func (x *Flipt) UpdateSegment(ctx context.Context, v *flipt.UpdateSegmentRequest) (*flipt.Segment, error)
- func (x *Flipt) UpdateVariant(ctx context.Context, v *flipt.UpdateVariantRequest) (*flipt.Variant, error)
- type JWTAuthenticationProvider
- type KubernetesAuthenticationProvider
- type KubernetesAuthenticationProviderOption
- type Meta
- type Option
- type PublicAuthenticationService
- type SDK
- type StaticClientTokenProvider
- type StaticTokenAuthenticationProvider
- type Transport
Examples ¶
Constants ¶
const DefaultNamespace = "default"
DefaultNamespace is the default namespace created in Flipt. This namespace is protected and will always be present. Omitting a namespace key leads to this namespace being referenced.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Analytics ¶ added in v0.11.0
type Analytics struct {
// contains filtered or unexported fields
}
func (*Analytics) GetFlagEvaluationsCount ¶ added in v0.11.0
func (x *Analytics) GetFlagEvaluationsCount(ctx context.Context, v *analytics.GetFlagEvaluationsCountRequest) (*analytics.GetFlagEvaluationsCountResponse, error)
type Auth ¶
type Auth struct {
// contains filtered or unexported fields
}
func (Auth) AuthenticationMethodGithubService ¶ added in v0.6.0
func (s Auth) AuthenticationMethodGithubService() *AuthenticationMethodGithubService
func (Auth) AuthenticationMethodKubernetesService ¶
func (s Auth) AuthenticationMethodKubernetesService() *AuthenticationMethodKubernetesService
func (Auth) AuthenticationMethodOIDCService ¶
func (s Auth) AuthenticationMethodOIDCService() *AuthenticationMethodOIDCService
func (Auth) AuthenticationMethodTokenService ¶
func (s Auth) AuthenticationMethodTokenService() *AuthenticationMethodTokenService
func (Auth) AuthenticationService ¶
func (s Auth) AuthenticationService() *AuthenticationService
func (Auth) PublicAuthenticationService ¶
func (s Auth) PublicAuthenticationService() *PublicAuthenticationService
type AuthClient ¶
type AuthClient interface { PublicAuthenticationServiceClient() auth.PublicAuthenticationServiceClient AuthenticationServiceClient() auth.AuthenticationServiceClient AuthenticationMethodTokenServiceClient() auth.AuthenticationMethodTokenServiceClient AuthenticationMethodOIDCServiceClient() auth.AuthenticationMethodOIDCServiceClient AuthenticationMethodKubernetesServiceClient() auth.AuthenticationMethodKubernetesServiceClient AuthenticationMethodGithubServiceClient() auth.AuthenticationMethodGithubServiceClient }
type AuthenticationMethodGithubService ¶ added in v0.6.0
type AuthenticationMethodGithubService struct {
// contains filtered or unexported fields
}
func (*AuthenticationMethodGithubService) AuthorizeURL ¶ added in v0.6.0
func (x *AuthenticationMethodGithubService) AuthorizeURL(ctx context.Context, v *auth.AuthorizeURLRequest) (*auth.AuthorizeURLResponse, error)
func (*AuthenticationMethodGithubService) Callback ¶ added in v0.6.0
func (x *AuthenticationMethodGithubService) Callback(ctx context.Context, v *auth.CallbackRequest) (*auth.CallbackResponse, error)
type AuthenticationMethodKubernetesService ¶
type AuthenticationMethodKubernetesService struct {
// contains filtered or unexported fields
}
func (*AuthenticationMethodKubernetesService) VerifyServiceAccount ¶
func (x *AuthenticationMethodKubernetesService) VerifyServiceAccount(ctx context.Context, v *auth.VerifyServiceAccountRequest) (*auth.VerifyServiceAccountResponse, error)
type AuthenticationMethodOIDCService ¶
type AuthenticationMethodOIDCService struct {
// contains filtered or unexported fields
}
func (*AuthenticationMethodOIDCService) AuthorizeURL ¶
func (x *AuthenticationMethodOIDCService) AuthorizeURL(ctx context.Context, v *auth.AuthorizeURLRequest) (*auth.AuthorizeURLResponse, error)
func (*AuthenticationMethodOIDCService) Callback ¶
func (x *AuthenticationMethodOIDCService) Callback(ctx context.Context, v *auth.CallbackRequest) (*auth.CallbackResponse, error)
type AuthenticationMethodTokenService ¶
type AuthenticationMethodTokenService struct {
// contains filtered or unexported fields
}
func (*AuthenticationMethodTokenService) CreateToken ¶
func (x *AuthenticationMethodTokenService) CreateToken(ctx context.Context, v *auth.CreateTokenRequest) (*auth.CreateTokenResponse, error)
type AuthenticationService ¶
type AuthenticationService struct {
// contains filtered or unexported fields
}
func (*AuthenticationService) DeleteAuthentication ¶
func (x *AuthenticationService) DeleteAuthentication(ctx context.Context, v *auth.DeleteAuthenticationRequest) error
func (*AuthenticationService) ExpireAuthenticationSelf ¶
func (x *AuthenticationService) ExpireAuthenticationSelf(ctx context.Context, v *auth.ExpireAuthenticationSelfRequest) error
func (*AuthenticationService) GetAuthentication ¶
func (x *AuthenticationService) GetAuthentication(ctx context.Context, v *auth.GetAuthenticationRequest) (*auth.Authentication, error)
func (*AuthenticationService) GetAuthenticationSelf ¶
func (x *AuthenticationService) GetAuthenticationSelf(ctx context.Context) (*auth.Authentication, error)
func (*AuthenticationService) ListAuthentications ¶
func (x *AuthenticationService) ListAuthentications(ctx context.Context, v *auth.ListAuthenticationsRequest) (*auth.ListAuthenticationsResponse, error)
type ClientAuthenticationProvider ¶ added in v0.9.0
ClientAuthenticationProvider is a type which when requested provides a client authentication which can be used to authenticate RPC/API calls invoked through the SDK.
type ClientTokenProvider ¶
ClientTokenProvider is a type which when requested provides a client token which can be used to authenticate RPC/API calls invoked through the SDK. Deprecated: Use ClientAuthenticationProvider instead.
type Evaluation ¶ added in v0.4.0
type Evaluation struct {
// contains filtered or unexported fields
}
func (*Evaluation) Batch ¶ added in v0.4.0
func (x *Evaluation) Batch(ctx context.Context, v *evaluation.BatchEvaluationRequest) (*evaluation.BatchEvaluationResponse, error)
func (*Evaluation) Boolean ¶ added in v0.4.0
func (x *Evaluation) Boolean(ctx context.Context, v *evaluation.EvaluationRequest) (*evaluation.BooleanEvaluationResponse, error)
Example ¶
// see the following subpackages for transport implementations: // - grpc // - http var transport Transport client := New(transport) client.Evaluation().Boolean(context.Background(), &evaluation.EvaluationRequest{ NamespaceKey: "my_namespace", FlagKey: "my_flag", EntityId: "my_entity", Context: map[string]string{"some": "context"}, })
Output:
func (*Evaluation) Variant ¶ added in v0.4.0
func (x *Evaluation) Variant(ctx context.Context, v *evaluation.EvaluationRequest) (*evaluation.VariantEvaluationResponse, error)
Example ¶
// see the following subpackages for transport implementations: // - grpc // - http var transport Transport client := New(transport) client.Evaluation().Variant(context.Background(), &evaluation.EvaluationRequest{ NamespaceKey: "my_namespace", FlagKey: "my_flag", EntityId: "my_entity", Context: map[string]string{"some": "context"}, })
Output:
type Flipt ¶
type Flipt struct {
// contains filtered or unexported fields
}
func (*Flipt) BatchEvaluate ¶
func (x *Flipt) BatchEvaluate(ctx context.Context, v *flipt.BatchEvaluationRequest) (*flipt.BatchEvaluationResponse, error)
func (*Flipt) CreateConstraint ¶
func (x *Flipt) CreateConstraint(ctx context.Context, v *flipt.CreateConstraintRequest) (*flipt.Constraint, error)
func (*Flipt) CreateDistribution ¶
func (x *Flipt) CreateDistribution(ctx context.Context, v *flipt.CreateDistributionRequest) (*flipt.Distribution, error)
func (*Flipt) CreateFlag ¶
func (*Flipt) CreateNamespace ¶ added in v0.2.0
func (*Flipt) CreateRollout ¶ added in v0.4.0
func (*Flipt) CreateRule ¶
func (*Flipt) CreateSegment ¶
func (*Flipt) CreateVariant ¶
func (*Flipt) DeleteConstraint ¶
func (*Flipt) DeleteDistribution ¶
func (*Flipt) DeleteFlag ¶
func (*Flipt) DeleteNamespace ¶ added in v0.2.0
func (*Flipt) DeleteRollout ¶ added in v0.4.0
func (*Flipt) DeleteRule ¶
func (*Flipt) DeleteSegment ¶
func (*Flipt) DeleteVariant ¶
func (*Flipt) Evaluate ¶
func (x *Flipt) Evaluate(ctx context.Context, v *flipt.EvaluationRequest) (*flipt.EvaluationResponse, error)
func (*Flipt) GetNamespace ¶ added in v0.2.0
func (*Flipt) GetRollout ¶ added in v0.4.0
func (*Flipt) GetSegment ¶
func (*Flipt) ListNamespaces ¶ added in v0.2.0
func (x *Flipt) ListNamespaces(ctx context.Context, v *flipt.ListNamespaceRequest) (*flipt.NamespaceList, error)
func (*Flipt) ListRollouts ¶ added in v0.4.0
func (x *Flipt) ListRollouts(ctx context.Context, v *flipt.ListRolloutRequest) (*flipt.RolloutList, error)
func (*Flipt) ListSegments ¶
func (x *Flipt) ListSegments(ctx context.Context, v *flipt.ListSegmentRequest) (*flipt.SegmentList, error)
func (*Flipt) OrderRollouts ¶ added in v0.4.0
func (*Flipt) OrderRules ¶
func (*Flipt) UpdateConstraint ¶
func (x *Flipt) UpdateConstraint(ctx context.Context, v *flipt.UpdateConstraintRequest) (*flipt.Constraint, error)
func (*Flipt) UpdateDistribution ¶
func (x *Flipt) UpdateDistribution(ctx context.Context, v *flipt.UpdateDistributionRequest) (*flipt.Distribution, error)
func (*Flipt) UpdateFlag ¶
func (*Flipt) UpdateNamespace ¶ added in v0.2.0
func (*Flipt) UpdateRollout ¶ added in v0.4.0
func (*Flipt) UpdateRule ¶
func (*Flipt) UpdateSegment ¶
func (*Flipt) UpdateVariant ¶
type JWTAuthenticationProvider ¶ added in v0.9.0
type JWTAuthenticationProvider string
JWTAuthenticationProvider is a string which is supplied as a JWT client authentication on each RPC which requires authentication.
func (JWTAuthenticationProvider) Authentication ¶ added in v0.9.0
func (p JWTAuthenticationProvider) Authentication(context.Context) (string, error)
Authentication returns the underlying string that is the JWTAuthenticationProvider.
type KubernetesAuthenticationProvider ¶ added in v0.10.0
type KubernetesAuthenticationProvider struct {
// contains filtered or unexported fields
}
KubernetesAuthenticationProvider is an implementation of ClientAuthenticationProvider which automatically uses the service account token from the environment and exchanges it with Flipt for a client token. This provider keeps the client token up to date and refreshes it for a new client token before expiry. It re-reads the service account token as Kubernetes can and will refresh this token, as it also has its own expiry.
func NewKubernetesAuthenticationProvider ¶ added in v0.10.0
func NewKubernetesAuthenticationProvider(transport Transport, opts ...KubernetesAuthenticationProviderOption) *KubernetesAuthenticationProvider
NewKubernetesAuthenticationProvider constructs and configures a new KubernetesAuthenticationProvider using the provided transport.
func (*KubernetesAuthenticationProvider) Authentication ¶ added in v0.10.0
func (k *KubernetesAuthenticationProvider) Authentication(ctx context.Context) (string, error)
Authentication returns the authentication header string to be used for a request by the client SDK. It is generated via exchanging the local service account token with Flipt for a client token. The token is then formatted appropriately for use in the Authentication header as a bearer token.
type KubernetesAuthenticationProviderOption ¶ added in v0.10.0
type KubernetesAuthenticationProviderOption func(*KubernetesAuthenticationProvider)
KubernetesAuthenticationProviderOption is a functional option for configuring KubernetesAuthenticationProvider.
func WithKubernetesExpiryLeeway ¶ added in v0.10.0
func WithKubernetesExpiryLeeway(d time.Duration) KubernetesAuthenticationProviderOption
WithKubernetesExpiryLeeway configures the duration leeway for deciding when to refresh the client token. The default is 10 seconds, which ensures that tokens are automatically refreshed when their is less that 10 seconds of lifetime left on the previously fetched client token.
func WithKubernetesServiceAccountTokenPath ¶ added in v0.10.0
func WithKubernetesServiceAccountTokenPath(p string) KubernetesAuthenticationProviderOption
WithKubernetesServiceAccountTokenPath sets the path on the host to locate the kubernetes service account. The KubernetesAuthenticationProvider uses the default location set by Kubernetes. This option lets you override that if your path happens to differ.
type Meta ¶
type Meta struct {
// contains filtered or unexported fields
}
func (*Meta) GetConfiguration ¶
type Option ¶
type Option func(*SDK)
Option is a functional option which configures the Flipt SDK.
func WithAuthenticationProvider ¶ added in v0.9.0
func WithAuthenticationProvider(p ClientAuthenticationProvider) Option
WithAuthenticationProviders returns an Option which configures any supplied SDK with the provided ClientAuthenticationProvider.
func WithClientTokenProvider ¶
func WithClientTokenProvider(p ClientTokenProvider) Option
WithClientTokenProviders returns an Option which configures any supplied SDK with the provided ClientTokenProvider. Deprecated: Use WithAuthenticationProvider instead.
type PublicAuthenticationService ¶
type PublicAuthenticationService struct {
// contains filtered or unexported fields
}
func (*PublicAuthenticationService) ListAuthenticationMethods ¶
func (x *PublicAuthenticationService) ListAuthenticationMethods(ctx context.Context) (*auth.ListAuthenticationMethodsResponse, error)
type SDK ¶
type SDK struct {
// contains filtered or unexported fields
}
SDK is the definition of Flipt's Go SDK. It depends on a pluggable transport implementation and exposes a consistent API surface area across both transport implementations. It also provides consistent client-side instrumentation and authentication lifecycle support.
func New ¶
New constructs and configures a Flipt SDK instance from the provided Transport implementation and options.
Example ¶
// see the following subpackages for transport implementations: // - grpc // - http var transport Transport client := New(transport) client.Flipt().GetFlag(context.Background(), &flipt.GetFlagRequest{ NamespaceKey: "my_namespace", Key: "my_flag", })
Output:
func (SDK) Evaluation ¶ added in v0.4.0
func (s SDK) Evaluation() *Evaluation
type StaticClientTokenProvider ¶
type StaticClientTokenProvider string
StaticClientTokenProvider is a string which is supplied as a static client token on each RPC which requires authentication. Deprecated: Use StaticTokenAuthenticationProvider instead.
func (StaticClientTokenProvider) ClientToken ¶
func (p StaticClientTokenProvider) ClientToken() (string, error)
ClientToken returns the underlying string that is the StaticClientTokenProvider. Deprecated: Use StaticTokenAuthenticationProvider instead.
type StaticTokenAuthenticationProvider ¶ added in v0.9.0
type StaticTokenAuthenticationProvider string
StaticTokenAuthenticationProvider is a string which is supplied as a static client authentication on each RPC which requires authentication.
func (StaticTokenAuthenticationProvider) Authentication ¶ added in v0.9.0
func (p StaticTokenAuthenticationProvider) Authentication(context.Context) (string, error)
Authentication returns the underlying string that is the StaticTokenAuthenticationProvider.
type Transport ¶
type Transport interface { AnalyticsClient() analytics.AnalyticsServiceClient AuthClient() AuthClient EvaluationClient() evaluation.EvaluationServiceClient FliptClient() flipt.FliptClient MetaClient() meta.MetadataServiceClient }