Skip to content

Commit bcad255

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Add Query Parameters to ListOrgConnections Endpoint (#3346)
Co-authored-by: ci.datadog-api-spec <[email protected]>
1 parent 2520d5c commit bcad255

File tree

3 files changed

+93
-2
lines changed

3 files changed

+93
-2
lines changed

.generator/schemas/v2/openapi.yaml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62417,6 +62417,39 @@ paths:
6241762417
get:
6241862418
description: Returns a list of org connections.
6241962419
operationId: ListOrgConnections
62420+
parameters:
62421+
- description: The Org ID of the sink org.
62422+
example: 0879ce27-29a1-481f-a12e-bc2a48ec9ae1
62423+
in: query
62424+
name: sink_org_id
62425+
required: false
62426+
schema:
62427+
type: string
62428+
- description: The Org ID of the source org.
62429+
example: 0879ce27-29a1-481f-a12e-bc2a48ec9ae1
62430+
in: query
62431+
name: source_org_id
62432+
required: false
62433+
schema:
62434+
type: string
62435+
- description: The limit of number of entries you want to return. Default is
62436+
1000.
62437+
example: 1000
62438+
in: query
62439+
name: limit
62440+
required: false
62441+
schema:
62442+
format: int64
62443+
type: integer
62444+
- description: The pagination offset which you want to query from. Default is
62445+
0.
62446+
example: 0
62447+
in: query
62448+
name: offset
62449+
required: false
62450+
schema:
62451+
format: int64
62452+
type: integer
6242062453
responses:
6242162454
'200':
6242262455
content:

api/datadogV2/api_org_connections.go

Lines changed: 59 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,15 +164,61 @@ func (a *OrgConnectionsApi) DeleteOrgConnections(ctx _context.Context, connectio
164164
return localVarHTTPResponse, nil
165165
}
166166

167+
// ListOrgConnectionsOptionalParameters holds optional parameters for ListOrgConnections.
168+
type ListOrgConnectionsOptionalParameters struct {
169+
SinkOrgId *string
170+
SourceOrgId *string
171+
Limit *int64
172+
Offset *int64
173+
}
174+
175+
// NewListOrgConnectionsOptionalParameters creates an empty struct for parameters.
176+
func NewListOrgConnectionsOptionalParameters() *ListOrgConnectionsOptionalParameters {
177+
this := ListOrgConnectionsOptionalParameters{}
178+
return &this
179+
}
180+
181+
// WithSinkOrgId sets the corresponding parameter name and returns the struct.
182+
func (r *ListOrgConnectionsOptionalParameters) WithSinkOrgId(sinkOrgId string) *ListOrgConnectionsOptionalParameters {
183+
r.SinkOrgId = &sinkOrgId
184+
return r
185+
}
186+
187+
// WithSourceOrgId sets the corresponding parameter name and returns the struct.
188+
func (r *ListOrgConnectionsOptionalParameters) WithSourceOrgId(sourceOrgId string) *ListOrgConnectionsOptionalParameters {
189+
r.SourceOrgId = &sourceOrgId
190+
return r
191+
}
192+
193+
// WithLimit sets the corresponding parameter name and returns the struct.
194+
func (r *ListOrgConnectionsOptionalParameters) WithLimit(limit int64) *ListOrgConnectionsOptionalParameters {
195+
r.Limit = &limit
196+
return r
197+
}
198+
199+
// WithOffset sets the corresponding parameter name and returns the struct.
200+
func (r *ListOrgConnectionsOptionalParameters) WithOffset(offset int64) *ListOrgConnectionsOptionalParameters {
201+
r.Offset = &offset
202+
return r
203+
}
204+
167205
// ListOrgConnections List Org Connections.
168206
// Returns a list of org connections.
169-
func (a *OrgConnectionsApi) ListOrgConnections(ctx _context.Context) (OrgConnectionListResponse, *_nethttp.Response, error) {
207+
func (a *OrgConnectionsApi) ListOrgConnections(ctx _context.Context, o ...ListOrgConnectionsOptionalParameters) (OrgConnectionListResponse, *_nethttp.Response, error) {
170208
var (
171209
localVarHTTPMethod = _nethttp.MethodGet
172210
localVarPostBody interface{}
173211
localVarReturnValue OrgConnectionListResponse
212+
optionalParams ListOrgConnectionsOptionalParameters
174213
)
175214

215+
if len(o) > 1 {
216+
return localVarReturnValue, nil, datadog.ReportError("only one argument of type ListOrgConnectionsOptionalParameters is allowed")
217+
}
218+
if len(o) == 1 {
219+
optionalParams = o[0]
220+
}
221+
176222
localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.OrgConnectionsApi.ListOrgConnections")
177223
if err != nil {
178224
return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()}
@@ -183,6 +229,18 @@ func (a *OrgConnectionsApi) ListOrgConnections(ctx _context.Context) (OrgConnect
183229
localVarHeaderParams := make(map[string]string)
184230
localVarQueryParams := _neturl.Values{}
185231
localVarFormParams := _neturl.Values{}
232+
if optionalParams.SinkOrgId != nil {
233+
localVarQueryParams.Add("sink_org_id", datadog.ParameterToString(*optionalParams.SinkOrgId, ""))
234+
}
235+
if optionalParams.SourceOrgId != nil {
236+
localVarQueryParams.Add("source_org_id", datadog.ParameterToString(*optionalParams.SourceOrgId, ""))
237+
}
238+
if optionalParams.Limit != nil {
239+
localVarQueryParams.Add("limit", datadog.ParameterToString(*optionalParams.Limit, ""))
240+
}
241+
if optionalParams.Offset != nil {
242+
localVarQueryParams.Add("offset", datadog.ParameterToString(*optionalParams.Offset, ""))
243+
}
186244
localVarHeaderParams["Accept"] = "application/json"
187245

188246
if a.Client.Cfg.DelegatedTokenConfig != nil {

examples/v2/org-connections/ListOrgConnections.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ func main() {
1717
configuration := datadog.NewConfiguration()
1818
apiClient := datadog.NewAPIClient(configuration)
1919
api := datadogV2.NewOrgConnectionsApi(apiClient)
20-
resp, r, err := api.ListOrgConnections(ctx)
20+
resp, r, err := api.ListOrgConnections(ctx, *datadogV2.NewListOrgConnectionsOptionalParameters())
2121

2222
if err != nil {
2323
fmt.Fprintf(os.Stderr, "Error when calling `OrgConnectionsApi.ListOrgConnections`: %v\n", err)

0 commit comments

Comments
 (0)