Skip to content

Commit 59f803f

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Add PAT/SAT management API endpoints (#3918)
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
1 parent 064ea68 commit 59f803f

59 files changed

Lines changed: 6299 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: 750 additions & 0 deletions
Large diffs are not rendered by default.

api/datadogV2/api_key_management.go

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

api/datadogV2/api_service_accounts.go

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

api/datadogV2/doc.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -425,18 +425,23 @@
425425
// - [JiraIntegrationApi.UpdateJiraIssueTemplate]
426426
// - [KeyManagementApi.CreateAPIKey]
427427
// - [KeyManagementApi.CreateCurrentUserApplicationKey]
428+
// - [KeyManagementApi.CreatePersonalAccessToken]
428429
// - [KeyManagementApi.DeleteAPIKey]
429430
// - [KeyManagementApi.DeleteApplicationKey]
430431
// - [KeyManagementApi.DeleteCurrentUserApplicationKey]
431432
// - [KeyManagementApi.GetAPIKey]
432433
// - [KeyManagementApi.GetApplicationKey]
433434
// - [KeyManagementApi.GetCurrentUserApplicationKey]
435+
// - [KeyManagementApi.GetPersonalAccessToken]
434436
// - [KeyManagementApi.ListAPIKeys]
435437
// - [KeyManagementApi.ListApplicationKeys]
436438
// - [KeyManagementApi.ListCurrentUserApplicationKeys]
439+
// - [KeyManagementApi.ListPersonalAccessTokens]
440+
// - [KeyManagementApi.RevokePersonalAccessToken]
437441
// - [KeyManagementApi.UpdateAPIKey]
438442
// - [KeyManagementApi.UpdateApplicationKey]
439443
// - [KeyManagementApi.UpdateCurrentUserApplicationKey]
444+
// - [KeyManagementApi.UpdatePersonalAccessToken]
440445
// - [LLMObservabilityApi.CreateLLMObsAnnotationQueue]
441446
// - [LLMObservabilityApi.CreateLLMObsAnnotationQueueInteractions]
442447
// - [LLMObservabilityApi.CreateLLMObsDataset]
@@ -817,10 +822,15 @@
817822
// - [SensitiveDataScannerApi.UpdateScanningGroup]
818823
// - [SensitiveDataScannerApi.UpdateScanningRule]
819824
// - [ServiceAccountsApi.CreateServiceAccount]
825+
// - [ServiceAccountsApi.CreateServiceAccountAccessToken]
820826
// - [ServiceAccountsApi.CreateServiceAccountApplicationKey]
821827
// - [ServiceAccountsApi.DeleteServiceAccountApplicationKey]
828+
// - [ServiceAccountsApi.GetServiceAccountAccessToken]
822829
// - [ServiceAccountsApi.GetServiceAccountApplicationKey]
830+
// - [ServiceAccountsApi.ListServiceAccountAccessTokens]
823831
// - [ServiceAccountsApi.ListServiceAccountApplicationKeys]
832+
// - [ServiceAccountsApi.RevokeServiceAccountAccessToken]
833+
// - [ServiceAccountsApi.UpdateServiceAccountAccessToken]
824834
// - [ServiceAccountsApi.UpdateServiceAccountApplicationKey]
825835
// - [ServiceDefinitionApi.CreateOrUpdateServiceDefinitions]
826836
// - [ServiceDefinitionApi.DeleteServiceDefinition]
Lines changed: 227 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,227 @@
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+
"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
9+
)
10+
11+
// FullPersonalAccessToken Datadog personal access token, including the token key.
12+
type FullPersonalAccessToken struct {
13+
// Attributes of a full personal access token, including the token key.
14+
Attributes *FullPersonalAccessTokenAttributes `json:"attributes,omitempty"`
15+
// ID of the personal access token.
16+
Id *string `json:"id,omitempty"`
17+
// Resources related to the personal access token.
18+
Relationships *PersonalAccessTokenRelationships `json:"relationships,omitempty"`
19+
// Personal access tokens resource type.
20+
Type *PersonalAccessTokensType `json:"type,omitempty"`
21+
// UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct
22+
UnparsedObject map[string]interface{} `json:"-"`
23+
AdditionalProperties map[string]interface{} `json:"-"`
24+
}
25+
26+
// NewFullPersonalAccessToken instantiates a new FullPersonalAccessToken object.
27+
// This constructor will assign default values to properties that have it defined,
28+
// and makes sure properties required by API are set, but the set of arguments
29+
// will change when the set of required properties is changed.
30+
func NewFullPersonalAccessToken() *FullPersonalAccessToken {
31+
this := FullPersonalAccessToken{}
32+
var typeVar PersonalAccessTokensType = PERSONALACCESSTOKENSTYPE_PERSONAL_ACCESS_TOKENS
33+
this.Type = &typeVar
34+
return &this
35+
}
36+
37+
// NewFullPersonalAccessTokenWithDefaults instantiates a new FullPersonalAccessToken object.
38+
// This constructor will only assign default values to properties that have it defined,
39+
// but it doesn't guarantee that properties required by API are set.
40+
func NewFullPersonalAccessTokenWithDefaults() *FullPersonalAccessToken {
41+
this := FullPersonalAccessToken{}
42+
var typeVar PersonalAccessTokensType = PERSONALACCESSTOKENSTYPE_PERSONAL_ACCESS_TOKENS
43+
this.Type = &typeVar
44+
return &this
45+
}
46+
47+
// GetAttributes returns the Attributes field value if set, zero value otherwise.
48+
func (o *FullPersonalAccessToken) GetAttributes() FullPersonalAccessTokenAttributes {
49+
if o == nil || o.Attributes == nil {
50+
var ret FullPersonalAccessTokenAttributes
51+
return ret
52+
}
53+
return *o.Attributes
54+
}
55+
56+
// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise
57+
// and a boolean to check if the value has been set.
58+
func (o *FullPersonalAccessToken) GetAttributesOk() (*FullPersonalAccessTokenAttributes, bool) {
59+
if o == nil || o.Attributes == nil {
60+
return nil, false
61+
}
62+
return o.Attributes, true
63+
}
64+
65+
// HasAttributes returns a boolean if a field has been set.
66+
func (o *FullPersonalAccessToken) HasAttributes() bool {
67+
return o != nil && o.Attributes != nil
68+
}
69+
70+
// SetAttributes gets a reference to the given FullPersonalAccessTokenAttributes and assigns it to the Attributes field.
71+
func (o *FullPersonalAccessToken) SetAttributes(v FullPersonalAccessTokenAttributes) {
72+
o.Attributes = &v
73+
}
74+
75+
// GetId returns the Id field value if set, zero value otherwise.
76+
func (o *FullPersonalAccessToken) GetId() string {
77+
if o == nil || o.Id == nil {
78+
var ret string
79+
return ret
80+
}
81+
return *o.Id
82+
}
83+
84+
// GetIdOk returns a tuple with the Id field value if set, nil otherwise
85+
// and a boolean to check if the value has been set.
86+
func (o *FullPersonalAccessToken) GetIdOk() (*string, bool) {
87+
if o == nil || o.Id == nil {
88+
return nil, false
89+
}
90+
return o.Id, true
91+
}
92+
93+
// HasId returns a boolean if a field has been set.
94+
func (o *FullPersonalAccessToken) HasId() bool {
95+
return o != nil && o.Id != nil
96+
}
97+
98+
// SetId gets a reference to the given string and assigns it to the Id field.
99+
func (o *FullPersonalAccessToken) SetId(v string) {
100+
o.Id = &v
101+
}
102+
103+
// GetRelationships returns the Relationships field value if set, zero value otherwise.
104+
func (o *FullPersonalAccessToken) GetRelationships() PersonalAccessTokenRelationships {
105+
if o == nil || o.Relationships == nil {
106+
var ret PersonalAccessTokenRelationships
107+
return ret
108+
}
109+
return *o.Relationships
110+
}
111+
112+
// GetRelationshipsOk returns a tuple with the Relationships field value if set, nil otherwise
113+
// and a boolean to check if the value has been set.
114+
func (o *FullPersonalAccessToken) GetRelationshipsOk() (*PersonalAccessTokenRelationships, bool) {
115+
if o == nil || o.Relationships == nil {
116+
return nil, false
117+
}
118+
return o.Relationships, true
119+
}
120+
121+
// HasRelationships returns a boolean if a field has been set.
122+
func (o *FullPersonalAccessToken) HasRelationships() bool {
123+
return o != nil && o.Relationships != nil
124+
}
125+
126+
// SetRelationships gets a reference to the given PersonalAccessTokenRelationships and assigns it to the Relationships field.
127+
func (o *FullPersonalAccessToken) SetRelationships(v PersonalAccessTokenRelationships) {
128+
o.Relationships = &v
129+
}
130+
131+
// GetType returns the Type field value if set, zero value otherwise.
132+
func (o *FullPersonalAccessToken) GetType() PersonalAccessTokensType {
133+
if o == nil || o.Type == nil {
134+
var ret PersonalAccessTokensType
135+
return ret
136+
}
137+
return *o.Type
138+
}
139+
140+
// GetTypeOk returns a tuple with the Type field value if set, nil otherwise
141+
// and a boolean to check if the value has been set.
142+
func (o *FullPersonalAccessToken) GetTypeOk() (*PersonalAccessTokensType, bool) {
143+
if o == nil || o.Type == nil {
144+
return nil, false
145+
}
146+
return o.Type, true
147+
}
148+
149+
// HasType returns a boolean if a field has been set.
150+
func (o *FullPersonalAccessToken) HasType() bool {
151+
return o != nil && o.Type != nil
152+
}
153+
154+
// SetType gets a reference to the given PersonalAccessTokensType and assigns it to the Type field.
155+
func (o *FullPersonalAccessToken) SetType(v PersonalAccessTokensType) {
156+
o.Type = &v
157+
}
158+
159+
// MarshalJSON serializes the struct using spec logic.
160+
func (o FullPersonalAccessToken) MarshalJSON() ([]byte, error) {
161+
toSerialize := map[string]interface{}{}
162+
if o.UnparsedObject != nil {
163+
return datadog.Marshal(o.UnparsedObject)
164+
}
165+
if o.Attributes != nil {
166+
toSerialize["attributes"] = o.Attributes
167+
}
168+
if o.Id != nil {
169+
toSerialize["id"] = o.Id
170+
}
171+
if o.Relationships != nil {
172+
toSerialize["relationships"] = o.Relationships
173+
}
174+
if o.Type != nil {
175+
toSerialize["type"] = o.Type
176+
}
177+
178+
for key, value := range o.AdditionalProperties {
179+
toSerialize[key] = value
180+
}
181+
return datadog.Marshal(toSerialize)
182+
}
183+
184+
// UnmarshalJSON deserializes the given payload.
185+
func (o *FullPersonalAccessToken) UnmarshalJSON(bytes []byte) (err error) {
186+
all := struct {
187+
Attributes *FullPersonalAccessTokenAttributes `json:"attributes,omitempty"`
188+
Id *string `json:"id,omitempty"`
189+
Relationships *PersonalAccessTokenRelationships `json:"relationships,omitempty"`
190+
Type *PersonalAccessTokensType `json:"type,omitempty"`
191+
}{}
192+
if err = datadog.Unmarshal(bytes, &all); err != nil {
193+
return datadog.Unmarshal(bytes, &o.UnparsedObject)
194+
}
195+
additionalProperties := make(map[string]interface{})
196+
if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil {
197+
datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "id", "relationships", "type"})
198+
} else {
199+
return err
200+
}
201+
202+
hasInvalidField := false
203+
if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil {
204+
hasInvalidField = true
205+
}
206+
o.Attributes = all.Attributes
207+
o.Id = all.Id
208+
if all.Relationships != nil && all.Relationships.UnparsedObject != nil && o.UnparsedObject == nil {
209+
hasInvalidField = true
210+
}
211+
o.Relationships = all.Relationships
212+
if all.Type != nil && !all.Type.IsValid() {
213+
hasInvalidField = true
214+
} else {
215+
o.Type = all.Type
216+
}
217+
218+
if len(additionalProperties) > 0 {
219+
o.AdditionalProperties = additionalProperties
220+
}
221+
222+
if hasInvalidField {
223+
return datadog.Unmarshal(bytes, &o.UnparsedObject)
224+
}
225+
226+
return nil
227+
}

0 commit comments

Comments
 (0)