Skip to content

Commit 31ebd91

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Regenerate client from commit 16c4984 of spec repo (#4196)
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
1 parent b332b54 commit 31ebd91

10 files changed

Lines changed: 637 additions & 0 deletions

.generator/schemas/v2/openapi.yaml

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57840,6 +57840,59 @@ components:
5784057840
- id
5784157841
- type
5784257842
type: object
57843+
OAuth2WellKnownSitesAttributes:
57844+
description: Attributes containing the list of public OAuth2 sites.
57845+
properties:
57846+
sites:
57847+
description: Array of public OAuth2 site URLs for the environment.
57848+
example:
57849+
- datadoghq.com
57850+
- datadoghq.eu
57851+
- us5.datadoghq.com
57852+
- us3.datadoghq.com
57853+
- ap1.datadoghq.com
57854+
- ap2.datadoghq.com
57855+
items:
57856+
description: Public OAuth2 site URL.
57857+
example: app.datadoghq.com
57858+
type: string
57859+
type: array
57860+
required:
57861+
- sites
57862+
type: object
57863+
OAuth2WellKnownSitesData:
57864+
description: Data object containing OAuth2 well-known sites information.
57865+
properties:
57866+
attributes:
57867+
$ref: "#/components/schemas/OAuth2WellKnownSitesAttributes"
57868+
id:
57869+
description: Environment identifier.
57870+
example: prod
57871+
type: string
57872+
type:
57873+
$ref: "#/components/schemas/OAuth2WellKnownSitesEnvType"
57874+
required:
57875+
- id
57876+
- type
57877+
- attributes
57878+
type: object
57879+
OAuth2WellKnownSitesEnvType:
57880+
default: env
57881+
description: JSON:API resource type for OAuth2 well-known sites environment.
57882+
enum:
57883+
- env
57884+
example: env
57885+
type: string
57886+
x-enum-varnames:
57887+
- ENV
57888+
OAuth2WellKnownSitesResponse:
57889+
description: Response payload containing the list of public OAuth2 sites for discovery.
57890+
properties:
57891+
data:
57892+
$ref: "#/components/schemas/OAuth2WellKnownSitesData"
57893+
required:
57894+
- data
57895+
type: object
5784357896
OAuthClientRegistrationError:
5784457897
description: Error payload returned by OAuth2 dynamic client registration as defined by RFC 7591.
5784557898
properties:
@@ -142472,6 +142525,40 @@ paths:
142472142525
summary: Get all aggregated DNS traffic
142473142526
tags:
142474142527
- Cloud Network Monitoring
142528+
/api/v2/oauth2/.well-known/sites:
142529+
get:
142530+
description: Retrieve the list of public OAuth2 sites available for the current environment. This endpoint is used for OAuth2 discovery and returns sites where users can authenticate.
142531+
operationId: GetOAuth2WellKnownSites
142532+
responses:
142533+
"200":
142534+
content:
142535+
application/json:
142536+
examples:
142537+
default:
142538+
value:
142539+
data:
142540+
attributes:
142541+
sites:
142542+
- datadoghq.com
142543+
- datadoghq.eu
142544+
- us5.datadoghq.com
142545+
- us3.datadoghq.com
142546+
- ap1.datadoghq.com
142547+
- ap2.datadoghq.com
142548+
id: prod
142549+
type: env
142550+
schema:
142551+
$ref: "#/components/schemas/OAuth2WellKnownSitesResponse"
142552+
description: OK
142553+
"429":
142554+
$ref: "#/components/responses/TooManyRequestsResponse"
142555+
security: []
142556+
summary: Get OAuth2 well-known sites
142557+
tags:
142558+
- OAuth2 Client Public
142559+
x-unstable: |-
142560+
**Note**: This endpoint is in preview and is subject to change.
142561+
If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).
142475142562
/api/v2/oauth2/clients/{client_uuid}/scopes_restriction:
142476142563
delete:
142477142564
description: Delete the scopes restriction configured for the OAuth2 client.

api/datadog/configuration.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1001,6 +1001,7 @@ func NewConfiguration() *Configuration {
10011001
"v2.ValidateExistingMonitorUserTemplate": false,
10021002
"v2.ValidateMonitorUserTemplate": false,
10031003
"v2.DeleteScopesRestriction": false,
1004+
"v2.GetOAuth2WellKnownSites": false,
10041005
"v2.GetScopesRestriction": false,
10051006
"v2.RegisterOAuthClient": false,
10061007
"v2.UpsertScopesRestriction": false,

api/datadogV2/api_o_auth2_client_public.go

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,79 @@ func (a *OAuth2ClientPublicApi) DeleteScopesRestriction(ctx _context.Context, cl
104104
return localVarHTTPResponse, nil
105105
}
106106

107+
// GetOAuth2WellKnownSites Get OAuth2 well-known sites.
108+
// Retrieve the list of public OAuth2 sites available for the current environment. This endpoint is used for OAuth2 discovery and returns sites where users can authenticate.
109+
func (a *OAuth2ClientPublicApi) GetOAuth2WellKnownSites(ctx _context.Context) (OAuth2WellKnownSitesResponse, *_nethttp.Response, error) {
110+
var (
111+
localVarHTTPMethod = _nethttp.MethodGet
112+
localVarPostBody interface{}
113+
localVarReturnValue OAuth2WellKnownSitesResponse
114+
)
115+
116+
operationId := "v2.GetOAuth2WellKnownSites"
117+
isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId)
118+
if !isOperationEnabled {
119+
return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)}
120+
}
121+
if isOperationEnabled && a.Client.Cfg.Debug {
122+
_log.Printf("WARNING: Using unstable operation '%s'", operationId)
123+
}
124+
125+
localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.OAuth2ClientPublicApi.GetOAuth2WellKnownSites")
126+
if err != nil {
127+
return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()}
128+
}
129+
130+
localVarPath := localBasePath + "/api/v2/oauth2/.well-known/sites"
131+
132+
localVarHeaderParams := make(map[string]string)
133+
localVarQueryParams := _neturl.Values{}
134+
localVarFormParams := _neturl.Values{}
135+
localVarHeaderParams["Accept"] = "application/json"
136+
137+
req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil)
138+
if err != nil {
139+
return localVarReturnValue, nil, err
140+
}
141+
142+
localVarHTTPResponse, err := a.Client.CallAPI(req)
143+
if err != nil || localVarHTTPResponse == nil {
144+
return localVarReturnValue, localVarHTTPResponse, err
145+
}
146+
147+
localVarBody, err := datadog.ReadBody(localVarHTTPResponse)
148+
if err != nil {
149+
return localVarReturnValue, localVarHTTPResponse, err
150+
}
151+
152+
if localVarHTTPResponse.StatusCode >= 300 {
153+
newErr := datadog.GenericOpenAPIError{
154+
ErrorBody: localVarBody,
155+
ErrorMessage: localVarHTTPResponse.Status,
156+
}
157+
if localVarHTTPResponse.StatusCode == 429 {
158+
var v APIErrorResponse
159+
err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
160+
if err != nil {
161+
return localVarReturnValue, localVarHTTPResponse, newErr
162+
}
163+
newErr.ErrorModel = v
164+
}
165+
return localVarReturnValue, localVarHTTPResponse, newErr
166+
}
167+
168+
err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
169+
if err != nil {
170+
newErr := datadog.GenericOpenAPIError{
171+
ErrorBody: localVarBody,
172+
ErrorMessage: err.Error(),
173+
}
174+
return localVarReturnValue, localVarHTTPResponse, newErr
175+
}
176+
177+
return localVarReturnValue, localVarHTTPResponse, nil
178+
}
179+
107180
// GetScopesRestriction Get an OAuth2 client scopes restriction.
108181
// Get the scopes restriction configured for the OAuth2 client.
109182
func (a *OAuth2ClientPublicApi) GetScopesRestriction(ctx _context.Context, clientUuid uuid.UUID) (OAuthScopesRestrictionResponse, *_nethttp.Response, error) {

api/datadogV2/doc.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -693,6 +693,7 @@
693693
// - [NetworkDeviceMonitoringApi.UpdateDeviceUserTags]
694694
// - [NetworkDeviceMonitoringApi.UpdateInterfaceUserTags]
695695
// - [OAuth2ClientPublicApi.DeleteScopesRestriction]
696+
// - [OAuth2ClientPublicApi.GetOAuth2WellKnownSites]
696697
// - [OAuth2ClientPublicApi.GetScopesRestriction]
697698
// - [OAuth2ClientPublicApi.RegisterOAuthClient]
698699
// - [OAuth2ClientPublicApi.UpsertScopesRestriction]
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
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+
// OAuth2WellKnownSitesAttributes Attributes containing the list of public OAuth2 sites.
14+
type OAuth2WellKnownSitesAttributes struct {
15+
// Array of public OAuth2 site URLs for the environment.
16+
Sites []string `json:"sites"`
17+
// UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct
18+
UnparsedObject map[string]interface{} `json:"-"`
19+
AdditionalProperties map[string]interface{} `json:"-"`
20+
}
21+
22+
// NewOAuth2WellKnownSitesAttributes instantiates a new OAuth2WellKnownSitesAttributes object.
23+
// This constructor will assign default values to properties that have it defined,
24+
// and makes sure properties required by API are set, but the set of arguments
25+
// will change when the set of required properties is changed.
26+
func NewOAuth2WellKnownSitesAttributes(sites []string) *OAuth2WellKnownSitesAttributes {
27+
this := OAuth2WellKnownSitesAttributes{}
28+
this.Sites = sites
29+
return &this
30+
}
31+
32+
// NewOAuth2WellKnownSitesAttributesWithDefaults instantiates a new OAuth2WellKnownSitesAttributes object.
33+
// This constructor will only assign default values to properties that have it defined,
34+
// but it doesn't guarantee that properties required by API are set.
35+
func NewOAuth2WellKnownSitesAttributesWithDefaults() *OAuth2WellKnownSitesAttributes {
36+
this := OAuth2WellKnownSitesAttributes{}
37+
return &this
38+
}
39+
40+
// GetSites returns the Sites field value.
41+
func (o *OAuth2WellKnownSitesAttributes) GetSites() []string {
42+
if o == nil {
43+
var ret []string
44+
return ret
45+
}
46+
return o.Sites
47+
}
48+
49+
// GetSitesOk returns a tuple with the Sites field value
50+
// and a boolean to check if the value has been set.
51+
func (o *OAuth2WellKnownSitesAttributes) GetSitesOk() (*[]string, bool) {
52+
if o == nil {
53+
return nil, false
54+
}
55+
return &o.Sites, true
56+
}
57+
58+
// SetSites sets field value.
59+
func (o *OAuth2WellKnownSitesAttributes) SetSites(v []string) {
60+
o.Sites = v
61+
}
62+
63+
// MarshalJSON serializes the struct using spec logic.
64+
func (o OAuth2WellKnownSitesAttributes) MarshalJSON() ([]byte, error) {
65+
toSerialize := map[string]interface{}{}
66+
if o.UnparsedObject != nil {
67+
return datadog.Marshal(o.UnparsedObject)
68+
}
69+
toSerialize["sites"] = o.Sites
70+
71+
for key, value := range o.AdditionalProperties {
72+
toSerialize[key] = value
73+
}
74+
return datadog.Marshal(toSerialize)
75+
}
76+
77+
// UnmarshalJSON deserializes the given payload.
78+
func (o *OAuth2WellKnownSitesAttributes) UnmarshalJSON(bytes []byte) (err error) {
79+
all := struct {
80+
Sites *[]string `json:"sites"`
81+
}{}
82+
if err = datadog.Unmarshal(bytes, &all); err != nil {
83+
return datadog.Unmarshal(bytes, &o.UnparsedObject)
84+
}
85+
if all.Sites == nil {
86+
return fmt.Errorf("required field sites missing")
87+
}
88+
additionalProperties := make(map[string]interface{})
89+
if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil {
90+
datadog.DeleteKeys(additionalProperties, &[]string{"sites"})
91+
} else {
92+
return err
93+
}
94+
o.Sites = *all.Sites
95+
96+
if len(additionalProperties) > 0 {
97+
o.AdditionalProperties = additionalProperties
98+
}
99+
100+
return nil
101+
}

0 commit comments

Comments
 (0)