Skip to content

Commit 3f80a51

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Add feature flags public api endpoints to api spec (#3848)
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
1 parent 76e4ce0 commit 3f80a51

65 files changed

Lines changed: 9546 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.generator/schemas/v2/openapi.yaml

Lines changed: 1246 additions & 0 deletions
Large diffs are not rendered by default.

api/datadogV2/api_feature_flags.go

Lines changed: 1143 additions & 0 deletions
Large diffs are not rendered by default.

api/datadogV2/doc.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,19 @@
290290
// - [FastlyIntegrationApi.ListFastlyServices]
291291
// - [FastlyIntegrationApi.UpdateFastlyAccount]
292292
// - [FastlyIntegrationApi.UpdateFastlyService]
293+
// - [FeatureFlagsApi.ArchiveFeatureFlag]
294+
// - [FeatureFlagsApi.CreateFeatureFlag]
295+
// - [FeatureFlagsApi.CreateFeatureFlagsEnvironment]
296+
// - [FeatureFlagsApi.DeleteFeatureFlagsEnvironment]
297+
// - [FeatureFlagsApi.DisableFeatureFlagEnvironment]
298+
// - [FeatureFlagsApi.EnableFeatureFlagEnvironment]
299+
// - [FeatureFlagsApi.GetFeatureFlag]
300+
// - [FeatureFlagsApi.GetFeatureFlagsEnvironment]
301+
// - [FeatureFlagsApi.ListFeatureFlags]
302+
// - [FeatureFlagsApi.ListFeatureFlagsEnvironments]
303+
// - [FeatureFlagsApi.UnarchiveFeatureFlag]
304+
// - [FeatureFlagsApi.UpdateFeatureFlag]
305+
// - [FeatureFlagsApi.UpdateFeatureFlagsEnvironment]
293306
// - [FleetAutomationApi.CancelFleetDeployment]
294307
// - [FleetAutomationApi.CreateFleetDeploymentConfigure]
295308
// - [FleetAutomationApi.CreateFleetDeploymentUpgrade]
Lines changed: 211 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,211 @@
1+
// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
2+
// This product includes software developed at Datadog (https://www.datadoghq.com/).
3+
// Copyright 2019-Present Datadog, Inc.
4+
5+
package datadogV2
6+
7+
import (
8+
"fmt"
9+
10+
"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
11+
)
12+
13+
// CreateEnvironmentAttributes Attributes for creating a new environment.
14+
type CreateEnvironmentAttributes struct {
15+
// Indicates whether this is a production environment.
16+
IsProduction *bool `json:"is_production,omitempty"`
17+
// The name of the environment.
18+
Name string `json:"name"`
19+
// List of queries to define the environment scope.
20+
Queries []string `json:"queries"`
21+
// Indicates whether feature flag changes require approval in this environment.
22+
RequireFeatureFlagApproval *bool `json:"require_feature_flag_approval,omitempty"`
23+
// UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct
24+
UnparsedObject map[string]interface{} `json:"-"`
25+
AdditionalProperties map[string]interface{} `json:"-"`
26+
}
27+
28+
// NewCreateEnvironmentAttributes instantiates a new CreateEnvironmentAttributes object.
29+
// This constructor will assign default values to properties that have it defined,
30+
// and makes sure properties required by API are set, but the set of arguments
31+
// will change when the set of required properties is changed.
32+
func NewCreateEnvironmentAttributes(name string, queries []string) *CreateEnvironmentAttributes {
33+
this := CreateEnvironmentAttributes{}
34+
var isProduction bool = false
35+
this.IsProduction = &isProduction
36+
this.Name = name
37+
this.Queries = queries
38+
var requireFeatureFlagApproval bool = false
39+
this.RequireFeatureFlagApproval = &requireFeatureFlagApproval
40+
return &this
41+
}
42+
43+
// NewCreateEnvironmentAttributesWithDefaults instantiates a new CreateEnvironmentAttributes object.
44+
// This constructor will only assign default values to properties that have it defined,
45+
// but it doesn't guarantee that properties required by API are set.
46+
func NewCreateEnvironmentAttributesWithDefaults() *CreateEnvironmentAttributes {
47+
this := CreateEnvironmentAttributes{}
48+
var isProduction bool = false
49+
this.IsProduction = &isProduction
50+
var requireFeatureFlagApproval bool = false
51+
this.RequireFeatureFlagApproval = &requireFeatureFlagApproval
52+
return &this
53+
}
54+
55+
// GetIsProduction returns the IsProduction field value if set, zero value otherwise.
56+
func (o *CreateEnvironmentAttributes) GetIsProduction() bool {
57+
if o == nil || o.IsProduction == nil {
58+
var ret bool
59+
return ret
60+
}
61+
return *o.IsProduction
62+
}
63+
64+
// GetIsProductionOk returns a tuple with the IsProduction field value if set, nil otherwise
65+
// and a boolean to check if the value has been set.
66+
func (o *CreateEnvironmentAttributes) GetIsProductionOk() (*bool, bool) {
67+
if o == nil || o.IsProduction == nil {
68+
return nil, false
69+
}
70+
return o.IsProduction, true
71+
}
72+
73+
// HasIsProduction returns a boolean if a field has been set.
74+
func (o *CreateEnvironmentAttributes) HasIsProduction() bool {
75+
return o != nil && o.IsProduction != nil
76+
}
77+
78+
// SetIsProduction gets a reference to the given bool and assigns it to the IsProduction field.
79+
func (o *CreateEnvironmentAttributes) SetIsProduction(v bool) {
80+
o.IsProduction = &v
81+
}
82+
83+
// GetName returns the Name field value.
84+
func (o *CreateEnvironmentAttributes) GetName() string {
85+
if o == nil {
86+
var ret string
87+
return ret
88+
}
89+
return o.Name
90+
}
91+
92+
// GetNameOk returns a tuple with the Name field value
93+
// and a boolean to check if the value has been set.
94+
func (o *CreateEnvironmentAttributes) GetNameOk() (*string, bool) {
95+
if o == nil {
96+
return nil, false
97+
}
98+
return &o.Name, true
99+
}
100+
101+
// SetName sets field value.
102+
func (o *CreateEnvironmentAttributes) SetName(v string) {
103+
o.Name = v
104+
}
105+
106+
// GetQueries returns the Queries field value.
107+
func (o *CreateEnvironmentAttributes) GetQueries() []string {
108+
if o == nil {
109+
var ret []string
110+
return ret
111+
}
112+
return o.Queries
113+
}
114+
115+
// GetQueriesOk returns a tuple with the Queries field value
116+
// and a boolean to check if the value has been set.
117+
func (o *CreateEnvironmentAttributes) GetQueriesOk() (*[]string, bool) {
118+
if o == nil {
119+
return nil, false
120+
}
121+
return &o.Queries, true
122+
}
123+
124+
// SetQueries sets field value.
125+
func (o *CreateEnvironmentAttributes) SetQueries(v []string) {
126+
o.Queries = v
127+
}
128+
129+
// GetRequireFeatureFlagApproval returns the RequireFeatureFlagApproval field value if set, zero value otherwise.
130+
func (o *CreateEnvironmentAttributes) GetRequireFeatureFlagApproval() bool {
131+
if o == nil || o.RequireFeatureFlagApproval == nil {
132+
var ret bool
133+
return ret
134+
}
135+
return *o.RequireFeatureFlagApproval
136+
}
137+
138+
// GetRequireFeatureFlagApprovalOk returns a tuple with the RequireFeatureFlagApproval field value if set, nil otherwise
139+
// and a boolean to check if the value has been set.
140+
func (o *CreateEnvironmentAttributes) GetRequireFeatureFlagApprovalOk() (*bool, bool) {
141+
if o == nil || o.RequireFeatureFlagApproval == nil {
142+
return nil, false
143+
}
144+
return o.RequireFeatureFlagApproval, true
145+
}
146+
147+
// HasRequireFeatureFlagApproval returns a boolean if a field has been set.
148+
func (o *CreateEnvironmentAttributes) HasRequireFeatureFlagApproval() bool {
149+
return o != nil && o.RequireFeatureFlagApproval != nil
150+
}
151+
152+
// SetRequireFeatureFlagApproval gets a reference to the given bool and assigns it to the RequireFeatureFlagApproval field.
153+
func (o *CreateEnvironmentAttributes) SetRequireFeatureFlagApproval(v bool) {
154+
o.RequireFeatureFlagApproval = &v
155+
}
156+
157+
// MarshalJSON serializes the struct using spec logic.
158+
func (o CreateEnvironmentAttributes) MarshalJSON() ([]byte, error) {
159+
toSerialize := map[string]interface{}{}
160+
if o.UnparsedObject != nil {
161+
return datadog.Marshal(o.UnparsedObject)
162+
}
163+
if o.IsProduction != nil {
164+
toSerialize["is_production"] = o.IsProduction
165+
}
166+
toSerialize["name"] = o.Name
167+
toSerialize["queries"] = o.Queries
168+
if o.RequireFeatureFlagApproval != nil {
169+
toSerialize["require_feature_flag_approval"] = o.RequireFeatureFlagApproval
170+
}
171+
172+
for key, value := range o.AdditionalProperties {
173+
toSerialize[key] = value
174+
}
175+
return datadog.Marshal(toSerialize)
176+
}
177+
178+
// UnmarshalJSON deserializes the given payload.
179+
func (o *CreateEnvironmentAttributes) UnmarshalJSON(bytes []byte) (err error) {
180+
all := struct {
181+
IsProduction *bool `json:"is_production,omitempty"`
182+
Name *string `json:"name"`
183+
Queries *[]string `json:"queries"`
184+
RequireFeatureFlagApproval *bool `json:"require_feature_flag_approval,omitempty"`
185+
}{}
186+
if err = datadog.Unmarshal(bytes, &all); err != nil {
187+
return datadog.Unmarshal(bytes, &o.UnparsedObject)
188+
}
189+
if all.Name == nil {
190+
return fmt.Errorf("required field name missing")
191+
}
192+
if all.Queries == nil {
193+
return fmt.Errorf("required field queries missing")
194+
}
195+
additionalProperties := make(map[string]interface{})
196+
if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil {
197+
datadog.DeleteKeys(additionalProperties, &[]string{"is_production", "name", "queries", "require_feature_flag_approval"})
198+
} else {
199+
return err
200+
}
201+
o.IsProduction = all.IsProduction
202+
o.Name = *all.Name
203+
o.Queries = *all.Queries
204+
o.RequireFeatureFlagApproval = all.RequireFeatureFlagApproval
205+
206+
if len(additionalProperties) > 0 {
207+
o.AdditionalProperties = additionalProperties
208+
}
209+
210+
return nil
211+
}
Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
2+
// This product includes software developed at Datadog (https://www.datadoghq.com/).
3+
// Copyright 2019-Present Datadog, Inc.
4+
5+
package datadogV2
6+
7+
import (
8+
"fmt"
9+
10+
"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
11+
)
12+
13+
// CreateEnvironmentData Data for creating a new environment.
14+
type CreateEnvironmentData struct {
15+
// Attributes for creating a new environment.
16+
Attributes CreateEnvironmentAttributes `json:"attributes"`
17+
// The resource type.
18+
Type CreateEnvironmentDataType `json:"type"`
19+
// UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct
20+
UnparsedObject map[string]interface{} `json:"-"`
21+
AdditionalProperties map[string]interface{} `json:"-"`
22+
}
23+
24+
// NewCreateEnvironmentData instantiates a new CreateEnvironmentData object.
25+
// This constructor will assign default values to properties that have it defined,
26+
// and makes sure properties required by API are set, but the set of arguments
27+
// will change when the set of required properties is changed.
28+
func NewCreateEnvironmentData(attributes CreateEnvironmentAttributes, typeVar CreateEnvironmentDataType) *CreateEnvironmentData {
29+
this := CreateEnvironmentData{}
30+
this.Attributes = attributes
31+
this.Type = typeVar
32+
return &this
33+
}
34+
35+
// NewCreateEnvironmentDataWithDefaults instantiates a new CreateEnvironmentData object.
36+
// This constructor will only assign default values to properties that have it defined,
37+
// but it doesn't guarantee that properties required by API are set.
38+
func NewCreateEnvironmentDataWithDefaults() *CreateEnvironmentData {
39+
this := CreateEnvironmentData{}
40+
return &this
41+
}
42+
43+
// GetAttributes returns the Attributes field value.
44+
func (o *CreateEnvironmentData) GetAttributes() CreateEnvironmentAttributes {
45+
if o == nil {
46+
var ret CreateEnvironmentAttributes
47+
return ret
48+
}
49+
return o.Attributes
50+
}
51+
52+
// GetAttributesOk returns a tuple with the Attributes field value
53+
// and a boolean to check if the value has been set.
54+
func (o *CreateEnvironmentData) GetAttributesOk() (*CreateEnvironmentAttributes, bool) {
55+
if o == nil {
56+
return nil, false
57+
}
58+
return &o.Attributes, true
59+
}
60+
61+
// SetAttributes sets field value.
62+
func (o *CreateEnvironmentData) SetAttributes(v CreateEnvironmentAttributes) {
63+
o.Attributes = v
64+
}
65+
66+
// GetType returns the Type field value.
67+
func (o *CreateEnvironmentData) GetType() CreateEnvironmentDataType {
68+
if o == nil {
69+
var ret CreateEnvironmentDataType
70+
return ret
71+
}
72+
return o.Type
73+
}
74+
75+
// GetTypeOk returns a tuple with the Type field value
76+
// and a boolean to check if the value has been set.
77+
func (o *CreateEnvironmentData) GetTypeOk() (*CreateEnvironmentDataType, bool) {
78+
if o == nil {
79+
return nil, false
80+
}
81+
return &o.Type, true
82+
}
83+
84+
// SetType sets field value.
85+
func (o *CreateEnvironmentData) SetType(v CreateEnvironmentDataType) {
86+
o.Type = v
87+
}
88+
89+
// MarshalJSON serializes the struct using spec logic.
90+
func (o CreateEnvironmentData) MarshalJSON() ([]byte, error) {
91+
toSerialize := map[string]interface{}{}
92+
if o.UnparsedObject != nil {
93+
return datadog.Marshal(o.UnparsedObject)
94+
}
95+
toSerialize["attributes"] = o.Attributes
96+
toSerialize["type"] = o.Type
97+
98+
for key, value := range o.AdditionalProperties {
99+
toSerialize[key] = value
100+
}
101+
return datadog.Marshal(toSerialize)
102+
}
103+
104+
// UnmarshalJSON deserializes the given payload.
105+
func (o *CreateEnvironmentData) UnmarshalJSON(bytes []byte) (err error) {
106+
all := struct {
107+
Attributes *CreateEnvironmentAttributes `json:"attributes"`
108+
Type *CreateEnvironmentDataType `json:"type"`
109+
}{}
110+
if err = datadog.Unmarshal(bytes, &all); err != nil {
111+
return datadog.Unmarshal(bytes, &o.UnparsedObject)
112+
}
113+
if all.Attributes == nil {
114+
return fmt.Errorf("required field attributes missing")
115+
}
116+
if all.Type == nil {
117+
return fmt.Errorf("required field type missing")
118+
}
119+
additionalProperties := make(map[string]interface{})
120+
if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil {
121+
datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "type"})
122+
} else {
123+
return err
124+
}
125+
126+
hasInvalidField := false
127+
if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil {
128+
hasInvalidField = true
129+
}
130+
o.Attributes = *all.Attributes
131+
if !all.Type.IsValid() {
132+
hasInvalidField = true
133+
} else {
134+
o.Type = *all.Type
135+
}
136+
137+
if len(additionalProperties) > 0 {
138+
o.AdditionalProperties = additionalProperties
139+
}
140+
141+
if hasInvalidField {
142+
return datadog.Unmarshal(bytes, &o.UnparsedObject)
143+
}
144+
145+
return nil
146+
}

0 commit comments

Comments
 (0)