generated from davidji99/terraform-provider-scaffolding
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
53 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package api | ||
|
||
import ( | ||
"fmt" | ||
"github.com/davidji99/simpleresty" | ||
) | ||
|
||
// FeatureFlagsService handles communication with the environments related | ||
// methods of the Split.io APIv2. | ||
// | ||
// Reference: https://docs.split.io/reference/feature-flag-overview | ||
type FeatureFlagsService service | ||
|
||
// FeatureFlag represents a feature flag in Split. | ||
type FeatureFlag struct { | ||
ID *string `json:"id"` | ||
Name *string `json:"name"` | ||
Description *string `json:"description"` | ||
TrafficType *TrafficType `json:"trafficType"` | ||
CreationTime *int64 `json:"creationTime"` | ||
Tags []*Tag `json:"tags"` | ||
} | ||
|
||
// FeatureFlagsListResponse represents the response when listing feature flags. | ||
type FeatureFlagsListResponse struct { | ||
GenericListResult | ||
FeatureFlags []*FeatureFlag `json:"objects"` | ||
} | ||
|
||
type FeatureFlagsListOpts struct { | ||
GenericListQueryParams | ||
|
||
// Tags are repeatable tag parameter(s) to query by | ||
Tags []string `url:"tags,omitempty"` | ||
} | ||
|
||
// List all feature flags. | ||
// | ||
// Reference: https://docs.split.io/reference/list-feature-flags | ||
func (f *FeatureFlagsService) List(workspaceID string, opts *FeatureFlagsListOpts) (*FeatureFlagsListResponse, *simpleresty.Response, error) { | ||
var result FeatureFlagsListResponse | ||
urlStr, err := f.client.http.RequestURLWithQueryParams(fmt.Sprintf("/splits/ws/%s", workspaceID), opts) | ||
if err != nil { | ||
return nil, nil, err | ||
} | ||
|
||
response, getErr := f.client.get(urlStr, &result, nil) | ||
|
||
return &result, response, getErr | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters