Skip to content

Commit 39a1457

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Add resource_type query param to authn mapping spec (#2515)
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
1 parent 3b4b179 commit 39a1457

File tree

4 files changed

+98
-8
lines changed

4 files changed

+98
-8
lines changed

.apigentools-info

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
"spec_versions": {
55
"v1": {
66
"apigentools_version": "1.6.6",
7-
"regenerated": "2024-07-18 19:52:51.351253",
8-
"spec_repo_commit": "17f1aa28"
7+
"regenerated": "2024-07-18 21:03:01.677704",
8+
"spec_repo_commit": "4e7a6907"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.6",
12-
"regenerated": "2024-07-18 19:52:51.369864",
13-
"spec_repo_commit": "17f1aa28"
12+
"regenerated": "2024-07-18 21:03:01.705009",
13+
"spec_repo_commit": "4e7a6907"
1414
}
1515
}
1616
}

.generator/schemas/v2/openapi.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1384,6 +1384,15 @@ components:
13841384
team:
13851385
$ref: '#/components/schemas/RelationshipToTeam'
13861386
type: object
1387+
AuthNMappingResourceType:
1388+
description: The type of resource being mapped to.
1389+
enum:
1390+
- role
1391+
- team
1392+
type: string
1393+
x-enum-varnames:
1394+
- ROLE
1395+
- TEAM
13871396
AuthNMappingResponse:
13881397
description: AuthN Mapping response from the API.
13891398
properties:
@@ -24696,6 +24705,11 @@ paths:
2469624705
required: false
2469724706
schema:
2469824707
type: string
24708+
- description: Filter by mapping resource type. Defaults to "role" if not specified.
24709+
in: query
24710+
name: resource_type
24711+
schema:
24712+
$ref: '#/components/schemas/AuthNMappingResourceType'
2469924713
responses:
2470024714
'200':
2470124715
content:

api/datadogV2/api_auth_n_mappings.go

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -223,10 +223,11 @@ func (a *AuthNMappingsApi) GetAuthNMapping(ctx _context.Context, authnMappingId
223223

224224
// ListAuthNMappingsOptionalParameters holds optional parameters for ListAuthNMappings.
225225
type ListAuthNMappingsOptionalParameters struct {
226-
PageSize *int64
227-
PageNumber *int64
228-
Sort *AuthNMappingsSort
229-
Filter *string
226+
PageSize *int64
227+
PageNumber *int64
228+
Sort *AuthNMappingsSort
229+
Filter *string
230+
ResourceType *AuthNMappingResourceType
230231
}
231232

232233
// NewListAuthNMappingsOptionalParameters creates an empty struct for parameters.
@@ -259,6 +260,12 @@ func (r *ListAuthNMappingsOptionalParameters) WithFilter(filter string) *ListAut
259260
return r
260261
}
261262

263+
// WithResourceType sets the corresponding parameter name and returns the struct.
264+
func (r *ListAuthNMappingsOptionalParameters) WithResourceType(resourceType AuthNMappingResourceType) *ListAuthNMappingsOptionalParameters {
265+
r.ResourceType = &resourceType
266+
return r
267+
}
268+
262269
// ListAuthNMappings List all AuthN Mappings.
263270
// List all AuthN Mappings in the org.
264271
func (a *AuthNMappingsApi) ListAuthNMappings(ctx _context.Context, o ...ListAuthNMappingsOptionalParameters) (AuthNMappingsResponse, *_nethttp.Response, error) {
@@ -298,6 +305,9 @@ func (a *AuthNMappingsApi) ListAuthNMappings(ctx _context.Context, o ...ListAuth
298305
if optionalParams.Filter != nil {
299306
localVarQueryParams.Add("filter", datadog.ParameterToString(*optionalParams.Filter, ""))
300307
}
308+
if optionalParams.ResourceType != nil {
309+
localVarQueryParams.Add("resource_type", datadog.ParameterToString(*optionalParams.ResourceType, ""))
310+
}
301311
localVarHeaderParams["Accept"] = "application/json"
302312

303313
datadog.SetAuthKeys(
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
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+
// AuthNMappingResourceType The type of resource being mapped to.
14+
type AuthNMappingResourceType string
15+
16+
// List of AuthNMappingResourceType.
17+
const (
18+
AUTHNMAPPINGRESOURCETYPE_ROLE AuthNMappingResourceType = "role"
19+
AUTHNMAPPINGRESOURCETYPE_TEAM AuthNMappingResourceType = "team"
20+
)
21+
22+
var allowedAuthNMappingResourceTypeEnumValues = []AuthNMappingResourceType{
23+
AUTHNMAPPINGRESOURCETYPE_ROLE,
24+
AUTHNMAPPINGRESOURCETYPE_TEAM,
25+
}
26+
27+
// GetAllowedValues reeturns the list of possible values.
28+
func (v *AuthNMappingResourceType) GetAllowedValues() []AuthNMappingResourceType {
29+
return allowedAuthNMappingResourceTypeEnumValues
30+
}
31+
32+
// UnmarshalJSON deserializes the given payload.
33+
func (v *AuthNMappingResourceType) UnmarshalJSON(src []byte) error {
34+
var value string
35+
err := datadog.Unmarshal(src, &value)
36+
if err != nil {
37+
return err
38+
}
39+
*v = AuthNMappingResourceType(value)
40+
return nil
41+
}
42+
43+
// NewAuthNMappingResourceTypeFromValue returns a pointer to a valid AuthNMappingResourceType
44+
// for the value passed as argument, or an error if the value passed is not allowed by the enum.
45+
func NewAuthNMappingResourceTypeFromValue(v string) (*AuthNMappingResourceType, error) {
46+
ev := AuthNMappingResourceType(v)
47+
if ev.IsValid() {
48+
return &ev, nil
49+
}
50+
return nil, fmt.Errorf("invalid value '%v' for AuthNMappingResourceType: valid values are %v", v, allowedAuthNMappingResourceTypeEnumValues)
51+
}
52+
53+
// IsValid return true if the value is valid for the enum, false otherwise.
54+
func (v AuthNMappingResourceType) IsValid() bool {
55+
for _, existing := range allowedAuthNMappingResourceTypeEnumValues {
56+
if existing == v {
57+
return true
58+
}
59+
}
60+
return false
61+
}
62+
63+
// Ptr returns reference to AuthNMappingResourceType value.
64+
func (v AuthNMappingResourceType) Ptr() *AuthNMappingResourceType {
65+
return &v
66+
}

0 commit comments

Comments
 (0)