Documentation ¶
Index ¶
- Constants
- Variables
- func AddAPIKey(reqBody admin.AddAPIKeyJSONRequestBody, projectIdentifier string, ...) (*admin.AddAPIKeyResponse, error)
- func AddAuthToken(ctx context.Context, req *http.Request) error
- func Authenticate(apiKey string, url string, target *client.Target) (*client.AuthenticateResponse, error)
- func AuthenticateSDKClient(key string, url string, target *client.Target) (token string, claims domain.Claims, err error)
- func CreateDefaultProject() (string, error)
- func CreateEnvironment(projectIdentifier string, environment, environmentName string) (*http.Response, error)
- func CreateEnvironmentRemote(projectIdentifier string, environment, environmentName string) (*http.Response, error)
- func CreateFeatureFlag(reqBody admin.CreateFeatureFlagJSONRequestBody) (*admin.CreateFeatureFlagResponse, error)
- func CreateProject(projectReq admin.CreateProjectJSONRequestBody) (*http.Response, error)
- func CreateProjectLocal(projectReq admin.CreateProjectJSONRequestBody) (*admin.CreateProjectResponse, error)
- func CreateProjectRemote(identifier string) (*http.Response, error)
- func CreateSegment(reqBody admin.CreateSegmentJSONRequestBody) (*admin.CreateSegmentResponse, error)
- func DecodeClaims(tokenString string) (domain.Claims, error)
- func DefaultClient() *admin.Client
- func DefaultEvaluationClient(url string) *client.Client
- func DeleteProject(identifier string) (*http.Response, error)
- func DeleteProjectRemote(identifier string) (*http.Response, error)
- func GenerateBooleanFeatureFlagBody(projectIdentifier string, id int) admin.CreateFeatureFlagJSONRequestBody
- func GenerateProjectIdentifier(seed string) string
- func GenerateStringFeatureFlagBody(projectIdentifier string, id int) admin.CreateFeatureFlagJSONRequestBody
- func GetAddAPIKeyBody(identifier string, apiKeyType string, name string, description string, ...) admin.AddAPIKeyJSONRequestBody
- func GetAuthToken() string
- func GetCertClient() *http.Client
- func GetClientURL() string
- func GetDefaultAccount() string
- func GetDefaultEnvironment() string
- func GetDefaultOrg() string
- func GetEnvironment(projectIdentifier string, environment string) (*admin.GetEnvironmentResponse, error)
- func GetPlatformBaseURL() string
- func GetSegmentRequestBody(project string, environment string, segmentIdentifier string, ...) admin.CreateSegmentJSONRequestBody
- func GetUserAccessToken() string
- func IsPlaformEnabled() bool
- func ReadProject(identifier admin.Identifier) (*admin.GetProjectResponse, error)
- func SetAuthToken(token string)
- func SetupAuth()
- type CreateRemoteProject
- type Environment
- type PlatformEnvironment
- type PlatformProject
- type Segment
- type TestProject
Constants ¶
const ( APIKeyTypeServer = "Server" APIKeyTypeClient = "Client" APIKeyExpiredAt = "" )
APIKeyName ...
const ( DefaultProjectIdentifier = "CF_SystemTest" DefaultProjectDesc = "CF System Test project" DefaultProjectName = "CF System Test" DefaultSegment = "group" DefaultSegmentName = "groupName" )
DefaultProjectIdentifier ...
const (
DefaultTagName = "default"
)
DefaultTagName ...
Variables ¶
var AuthToken string
AuthToken used to authenticate with the remote service
Functions ¶
func AddAPIKey ¶
func AddAPIKey(reqBody admin.AddAPIKeyJSONRequestBody, projectIdentifier string, envIdentifier string) (*admin.AddAPIKeyResponse, error)
AddAPIKey ...
func AddAuthToken ¶
AddAuthToken adds the appropriate token to the request. If we are using a JWT it sets the authorization header, and if were using a PAT/SAT it sets the x-api-key header
func Authenticate ¶
func Authenticate(apiKey string, url string, target *client.Target) (*client.AuthenticateResponse, error)
Authenticate is wrapper around the rest client for the Auth API
func AuthenticateSDKClient ¶
func AuthenticateSDKClient(key string, url string, target *client.Target) (token string, claims domain.Claims, err error)
AuthenticateSDKClient performs an auth request and returns the token and environment to use
func CreateEnvironment ¶
func CreateEnvironment(projectIdentifier string, environment, environmentName string) (*http.Response, error)
CreateEnvironment ...
func CreateEnvironmentRemote ¶
func CreateEnvironmentRemote(projectIdentifier string, environment, environmentName string) (*http.Response, error)
CreateEnvironmentRemote ...
func CreateFeatureFlag ¶
func CreateFeatureFlag(reqBody admin.CreateFeatureFlagJSONRequestBody) (*admin.CreateFeatureFlagResponse, error)
CreateFeatureFlag ...
func CreateProject ¶
func CreateProject(projectReq admin.CreateProjectJSONRequestBody) (*http.Response, error)
CreateProject ...
func CreateProjectLocal ¶
func CreateProjectLocal(projectReq admin.CreateProjectJSONRequestBody) (*admin.CreateProjectResponse, error)
CreateProjectLocal ...
func CreateProjectRemote ¶
CreateProjectRemote ...
func CreateSegment ¶
func CreateSegment(reqBody admin.CreateSegmentJSONRequestBody) (*admin.CreateSegmentResponse, error)
CreateSegment ...
func DefaultClient ¶
DefaultClient returns the default admin client
func DefaultEvaluationClient ¶
DefaultEvaluationClient creates a default client for the evaluation service
func DeleteProject ¶
DeleteProject ...
func DeleteProjectRemote ¶
DeleteProjectRemote ...
func GenerateBooleanFeatureFlagBody ¶
func GenerateBooleanFeatureFlagBody(projectIdentifier string, id int) admin.CreateFeatureFlagJSONRequestBody
GenerateBooleanFeatureFlagBody ...
func GenerateProjectIdentifier ¶
GenerateProjectIdentifier ...
func GenerateStringFeatureFlagBody ¶
func GenerateStringFeatureFlagBody(projectIdentifier string, id int) admin.CreateFeatureFlagJSONRequestBody
GenerateStringFeatureFlagBody ...
func GetAddAPIKeyBody ¶
func GetAddAPIKeyBody(identifier string, apiKeyType string, name string, description string, expiredAt string) admin.AddAPIKeyJSONRequestBody
GetAddAPIKeyBody ...
func GetCertClient ¶
GetCertClient returns a custom http client which defines a certificate authority and trusts our certs from the /cert folder this avoids any errors when run locally and doesn't require the certs to be manually trusted on your machine
func GetEnvironment ¶
func GetEnvironment(projectIdentifier string, environment string) (*admin.GetEnvironmentResponse, error)
GetEnvironment ...
func GetSegmentRequestBody ¶
func GetSegmentRequestBody(project string, environment string, segmentIdentifier string, segmentName string, included *[]string, excluded *[]string, tags *[]admin.Tag, clauses *[]admin.Clause) admin.CreateSegmentJSONRequestBody
GetSegmentRequestBody ...
func ReadProject ¶
func ReadProject(identifier admin.Identifier) (*admin.GetProjectResponse, error)
ReadProject ...
Types ¶
type CreateRemoteProject ¶
type CreateRemoteProject struct {
Project PlatformProject `json:"project"`
}
CreateRemoteProject ...
type Environment ¶
type Environment struct { Identifier string Name string Project string Keys []v1.ApiKey Targets []v1.Target Segments map[string]Segment }
Environment contains entities that we will use to drive test data
func (Environment) ToEnvironment ¶
func (e Environment) ToEnvironment() v1.Environment
ToEnvironment converts the test environment to a v1.Environment for use in API calls
type PlatformEnvironment ¶
type PlatformEnvironment struct { Name string `json:"name"` Identifier string `json:"identifier"` ProjectIdentifier string `json:"projectIdentifier"` OrgIdentifier string `json:"orgIdentifier"` Type string `json:"type"` }
PlatformEnvironment ...
type PlatformProject ¶
type PlatformProject struct { Name string `json:"name"` OrgIdentifier string `json:"orgIdentifier"` Description string `json:"description"` Identifier string `json:"identifier"` }
PlatformProject ...
type TestProject ¶
type TestProject struct { Account string Organization string ProjectIdentifier string Environment Environment Flags map[string]v1.FeatureFlagRequest }
TestProject represents a project that we will create during tests
func SetupTestProject ¶
func SetupTestProject() (TestProject, error)
SetupTestProject creates a new project and environment for the tests