Help us shape the future of Go! Take the 2026 Go Developer Survey

flagsmith

package
v0.12.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 26, 2026 License: MPL-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

View Source
const BaseAPIURL = "https://api.flagsmith.com/api/v1"

Variables

This section is empty.

Functions

func Difference added in v0.4.1

func Difference(a, b *[]int64) []int64

Difference returns a slice of 64-bit integers containing the elements of a that are not present in b. If a or b is nil, they are treated as empty slices.

func New

func New(version string) func() provider.Provider

Types

type Condition added in v0.3.0

type Condition struct {
	Operator types.String `tfsdk:"operator"`
	Property types.String `tfsdk:"property"`
	Value    types.String `tfsdk:"value"`
}

func MakeConditionFromClientCondition added in v0.3.0

func MakeConditionFromClientCondition(clientCondition *flagsmithapi.Condition) Condition

func (*Condition) ToClientCondition added in v0.3.0

func (c *Condition) ToClientCondition() *flagsmithapi.Condition

type EnvironmentResourceData added in v0.9.0

type EnvironmentResourceData struct {
	ID                                types.Int64  `tfsdk:"id"`
	UUID                              types.String `tfsdk:"uuid"`
	Name                              types.String `tfsdk:"name"`
	APIKey                            types.String `tfsdk:"api_key"`
	ProjectID                         types.Int64  `tfsdk:"project_id"`
	Description                       types.String `tfsdk:"description"`
	AllowClientTraits                 types.Bool   `tfsdk:"allow_client_traits"`
	BannerText                        types.String `tfsdk:"banner_text"`
	BannerColour                      types.String `tfsdk:"banner_colour"`
	HideDisabledFlags                 types.Bool   `tfsdk:"hide_disabled_flags"`
	HideSensitiveData                 types.Bool   `tfsdk:"hide_sensitive_data"`
	UseIdentityCompositeKeyForHashing types.Bool   `tfsdk:"use_identity_composite_key_for_hashing"`
	MinimumChangeRequestApprovals     types.Int64  `tfsdk:"minimum_change_request_approvals"`
	Metadata                          types.Map    `tfsdk:"metadata"`
}

func MakeEnvironmentResourceDataFromClientEnvironment added in v0.9.0

func MakeEnvironmentResourceDataFromClientEnvironment(clientEnvironment *flagsmithapi.Environment, metadata types.Map) EnvironmentResourceData

metadata is passed in already resolved: the client struct carries model field IDs, and mapping those to custom field names needs an API lookup.

func (*EnvironmentResourceData) ToClientEnvironment added in v0.9.0

func (e *EnvironmentResourceData) ToClientEnvironment() *flagsmithapi.Environment

type FeatureResourceData added in v0.2.0

type FeatureResourceData struct {
	UUID           types.String   `tfsdk:"uuid"`
	ID             types.Int64    `tfsdk:"id"`
	Name           types.String   `tfsdk:"feature_name"`
	Type           types.String   `tfsdk:"type"`
	Description    types.String   `tfsdk:"description"`
	InitialValue   types.String   `tfsdk:"initial_value"`
	DefaultEnabled types.Bool     `tfsdk:"default_enabled"`
	IsArchived     types.Bool     `tfsdk:"is_archived"`
	Owners         *[]types.Int64 `tfsdk:"owners"`
	GroupOwners    *[]types.Int64 `tfsdk:"group_owners"`
	Tags           *[]types.Int64 `tfsdk:"tags"`
	ProjectID      types.Int64    `tfsdk:"project_id"`
	ProjectUUID    types.String   `tfsdk:"project_uuid"`
	Metadata       types.Map      `tfsdk:"metadata"`
}

func MakeFeatureResourceDataFromClientFeature added in v0.2.0

func MakeFeatureResourceDataFromClientFeature(clientFeature *flagsmithapi.Feature, metadata types.Map) FeatureResourceData

metadata is passed in already resolved: the client struct carries model field IDs, and mapping those to custom field names needs an API lookup.

func (*FeatureResourceData) ToClientFeature added in v0.2.0

func (f *FeatureResourceData) ToClientFeature() *flagsmithapi.Feature

type FeatureStateResourceData added in v0.2.0

type FeatureStateResourceData struct {
	ID                types.Int64        `tfsdk:"id"`
	UUID              types.String       `tfsdk:"uuid"`
	Enabled           types.Bool         `tfsdk:"enabled"`
	FeatureStateValue *FeatureStateValue `tfsdk:"feature_state_value"`
	Feature           types.Int64        `tfsdk:"feature_id"`
	Environment       types.Int64        `tfsdk:"environment_id"`
	EnvironmentKey    types.String       `tfsdk:"environment_key"`
	Segment           types.Int64        `tfsdk:"segment_id"`
	SegmentPriority   types.Int64        `tfsdk:"segment_priority"`
	FeatureSegment    types.Int64        `tfsdk:"feature_segment_id"`
}

func MakeFeatureStateResourceDataFromClientFS added in v0.2.0

func MakeFeatureStateResourceDataFromClientFS(clientFS *flagsmithapi.FeatureState) FeatureStateResourceData

Generate a new FeatureStateResourceData from client `FeatureState`

func (*FeatureStateResourceData) ToClientFS added in v0.2.0

type FeatureStateValue

type FeatureStateValue struct {
	Type         types.String `tfsdk:"type"`
	StringValue  types.String `tfsdk:"string_value"`
	IntegerValue types.Int64  `tfsdk:"integer_value"`
	BooleanValue types.Bool   `tfsdk:"boolean_value"`
}

func MakeFeatureStateValueFromClientFSV

func MakeFeatureStateValueFromClientFSV(clientFSV *flagsmithapi.FeatureStateValue) FeatureStateValue

func (*FeatureStateValue) ToClientFSV

type MultivariateOptionResourceData added in v0.2.0

type MultivariateOptionResourceData struct {
	Type                        types.String `tfsdk:"type"`
	ID                          types.Int64  `tfsdk:"id"`
	UUID                        types.String `tfsdk:"uuid"`
	FeatureID                   types.Int64  `tfsdk:"feature_id"`
	FeatureUUID                 types.String `tfsdk:"feature_uuid"`
	ProjectID                   types.Int64  `tfsdk:"project_id"`
	IntegerValue                types.Int64  `tfsdk:"integer_value"`
	StringValue                 types.String `tfsdk:"string_value"`
	BooleanValue                types.Bool   `tfsdk:"boolean_value"`
	DefaultPercentageAllocation types.Number `tfsdk:"default_percentage_allocation"`
}

func NewMultivariateOptionFromClientOption added in v0.2.0

func NewMultivariateOptionFromClientOption(clientMvOption *flagsmithapi.FeatureMultivariateOption) MultivariateOptionResourceData

func (*MultivariateOptionResourceData) ToClientMultivariateOption added in v0.2.0

type NestedRule added in v0.3.0

type NestedRule struct {
	Conditions []Condition  `tfsdk:"conditions"`
	Type       types.String `tfsdk:"type"`
}

func MakeNestedRuleFromClientRule added in v0.3.0

func MakeNestedRuleFromClientRule(clientRule *flagsmithapi.Rule) NestedRule

func (*NestedRule) ToClientRule added in v0.3.0

func (r *NestedRule) ToClientRule() *flagsmithapi.Rule

type OrganisationResourceData added in v0.9.0

type OrganisationResourceData struct {
	ID                           types.Int64  `tfsdk:"id"`
	UUID                         types.String `tfsdk:"uuid"`
	Name                         types.String `tfsdk:"name"`
	Force2FA                     types.Bool   `tfsdk:"force_2fa"`
	PersistTraitData             types.Bool   `tfsdk:"persist_trait_data"`
	RestrictProjectCreateToAdmin types.Bool   `tfsdk:"restrict_project_create_to_admin"`
}

func MakeOrganisationResourceDataFromClientOrganisation added in v0.9.0

func MakeOrganisationResourceDataFromClientOrganisation(clientOrganisation *flagsmithapi.Organisation) OrganisationResourceData

type ProjectResourceData added in v0.9.0

type ProjectResourceData struct {
	ID                             types.Int64  `tfsdk:"id"`
	UUID                           types.String `tfsdk:"uuid"`
	Name                           types.String `tfsdk:"name"`
	OrganisationID                 types.Int64  `tfsdk:"organisation_id"`
	HideDisabledFlags              types.Bool   `tfsdk:"hide_disabled_flags"`
	PreventFlagDefaults            types.Bool   `tfsdk:"prevent_flag_defaults"`
	EnableRealtimeUpdates          types.Bool   `tfsdk:"enable_realtime_updates"`
	OnlyAllowLowerCaseFeatureNames types.Bool   `tfsdk:"only_allow_lower_case_feature_names"`
	FeatureNameRegex               types.String `tfsdk:"feature_name_regex"`
	StaleFlagsLimitDays            types.Int64  `tfsdk:"stale_flags_limit_days"`
	EnforceFeatureOwners           types.Bool   `tfsdk:"enforce_feature_owners"`
}

func MakeProjectResourceDataFromClientProject added in v0.9.0

func MakeProjectResourceDataFromClientProject(clientProject *flagsmithapi.Project) ProjectResourceData

func (*ProjectResourceData) ToClientProject added in v0.9.0

func (p *ProjectResourceData) ToClientProject() *flagsmithapi.Project

type Rule added in v0.3.0

type Rule struct {
	Type       types.String `tfsdk:"type"`
	Rules      []NestedRule `tfsdk:"rules"`
	Conditions []Condition  `tfsdk:"conditions"`
}

func MakeRuleFromClientRule added in v0.3.0

func MakeRuleFromClientRule(clientRule *flagsmithapi.Rule) Rule

func (*Rule) ToClientRule added in v0.3.0

func (r *Rule) ToClientRule() *flagsmithapi.Rule

type SegmentResourceData added in v0.3.0

type SegmentResourceData struct {
	ID          types.Int64  `tfsdk:"id"`
	UUID        types.String `tfsdk:"uuid"`
	Name        types.String `tfsdk:"name"`
	Description types.String `tfsdk:"description"`
	ProjectID   types.Int64  `tfsdk:"project_id"`
	ProjectUUID types.String `tfsdk:"project_uuid"`
	FeatureID   types.Int64  `tfsdk:"feature_id"`
	Rules       []Rule       `tfsdk:"rules"`
	Metadata    types.Map    `tfsdk:"metadata"`
}

func MakeSegmentResourceDataFromClientSegment added in v0.3.0

func MakeSegmentResourceDataFromClientSegment(clientSegment *flagsmithapi.Segment, metadata types.Map) SegmentResourceData

metadata is passed in already resolved: the client struct carries model field IDs, and mapping those to custom field names needs an API lookup.

func (*SegmentResourceData) ToClientSegment added in v0.3.0

func (s *SegmentResourceData) ToClientSegment() *flagsmithapi.Segment

type TagResourceData added in v0.7.0

type TagResourceData struct {
	ID          types.Int64  `tfsdk:"id"`
	UUID        types.String `tfsdk:"uuid"`
	Name        types.String `tfsdk:"tag_name"`
	Description types.String `tfsdk:"description"`
	ProjectID   types.Int64  `tfsdk:"project_id"`
	ProjectUUID types.String `tfsdk:"project_uuid"`
	Colour      types.String `tfsdk:"tag_colour"`
}

func MakeTagResourceDataFromClientTag added in v0.7.0

func MakeTagResourceDataFromClientTag(clientTag *flagsmithapi.Tag) TagResourceData

func (*TagResourceData) ToClientTag added in v0.7.0

func (t *TagResourceData) ToClientTag() *flagsmithapi.Tag

type UserResourceData added in v0.10.0

type UserResourceData struct {
	ID             types.Int64  `tfsdk:"id"`
	OrganisationID types.Int64  `tfsdk:"organisation_id"`
	Email          types.String `tfsdk:"email"`
	FirstName      types.String `tfsdk:"first_name"`
	LastName       types.String `tfsdk:"last_name"`
	Role           types.String `tfsdk:"role"`
}

func MakeUserResourceDataFromClientUser added in v0.10.0

func MakeUserResourceDataFromClientUser(clientUser *flagsmithapi.User, orgID int64) UserResourceData

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL