Skip to content

Commit

Permalink
Regenerate client from commit e78b9143 of spec repo
Browse files Browse the repository at this point in the history
  • Loading branch information
ci.datadog-api-spec committed Jul 30, 2024
1 parent f4af254 commit 3b81821
Show file tree
Hide file tree
Showing 20 changed files with 844 additions and 5 deletions.
8 changes: 4 additions & 4 deletions .apigentools-info
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
"spec_versions": {
"v1": {
"apigentools_version": "1.6.6",
"regenerated": "2024-07-26 19:06:16.771423",
"spec_repo_commit": "44cf4afe"
"regenerated": "2024-07-30 13:34:24.619275",
"spec_repo_commit": "e78b9143"
},
"v2": {
"apigentools_version": "1.6.6",
"regenerated": "2024-07-26 19:06:16.789960",
"spec_repo_commit": "44cf4afe"
"regenerated": "2024-07-30 13:34:24.637577",
"spec_repo_commit": "e78b9143"
}
}
}
92 changes: 92 additions & 0 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11316,6 +11316,37 @@ components:
example: /api/v2/scorecard/rules?page%5Blimit%5D=2&page%5Boffset%5D=2&page%5Bsize%5D=2
type: string
type: object
ListTagsResponse:
description: List tags response.
properties:
data:
$ref: '#/components/schemas/ListTagsResponseData'
type: object
ListTagsResponseData:
description: The list tags response data.
properties:
attributes:
$ref: '#/components/schemas/ListTagsResponseDataAttributes'
id:
description: The device ID
example: example:1.2.3.4
type: string
type:
description: The type of the resource. The value should always be tags.
type: string
type: object
ListTagsResponseDataAttributes:
description: The definition of ListTagsResponseDataAttributes object.
properties:
tags:
description: The list of tags
example:
- tag:test
- tag:testbis
items:
type: string
type: array
type: object
ListTeamsInclude:
description: Included related resources optionally requested.
enum:
Expand Down Expand Up @@ -31426,6 +31457,67 @@ paths:
summary: Get the list of interfaces of the device
tags:
- Network Device Monitoring
/api/v2/ndm/tags/devices/{device_id}:
get:
description: Get the list of tags for a device.
operationId: ListDeviceUserTags
parameters:
- description: The id of the device to fetch tags for.
example: example:1.2.3.4
in: path
name: device_id
required: true
schema:
type: string
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/ListTagsResponse'
description: OK
'403':
$ref: '#/components/responses/ForbiddenResponse'
'404':
$ref: '#/components/responses/NotFoundResponse'
'429':
$ref: '#/components/responses/TooManyRequestsResponse'
summary: Get the list of tags for a device
tags:
- Network Device Monitoring
patch:
description: Update the tags for a device.
operationId: UpdateDeviceUserTags
parameters:
- description: The id of the device to update tags for.
example: example:1.2.3.4
in: path
name: device_id
required: true
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/ListTagsResponse'
required: true
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/ListTagsResponse'
description: OK
'403':
$ref: '#/components/responses/ForbiddenResponse'
'404':
$ref: '#/components/responses/NotFoundResponse'
'429':
$ref: '#/components/responses/TooManyRequestsResponse'
summary: Update the tags for a device
tags:
- Network Device Monitoring
/api/v2/org_configs:
get:
description: Returns all Org Configs (name, description, and value).
Expand Down
145 changes: 145 additions & 0 deletions api/datadogV2/api_network_device_monitoring.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,77 @@ func (a *NetworkDeviceMonitoringApi) GetInterfaces(ctx _context.Context, deviceI
return localVarReturnValue, localVarHTTPResponse, nil
}

// ListDeviceUserTags Get the list of tags for a device.
// Get the list of tags for a device.
func (a *NetworkDeviceMonitoringApi) ListDeviceUserTags(ctx _context.Context, deviceId string) (ListTagsResponse, *_nethttp.Response, error) {
var (
localVarHTTPMethod = _nethttp.MethodGet
localVarPostBody interface{}
localVarReturnValue ListTagsResponse
)

localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.NetworkDeviceMonitoringApi.ListDeviceUserTags")
if err != nil {
return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()}
}

localVarPath := localBasePath + "/api/v2/ndm/tags/devices/{device_id}"
localVarPath = strings.Replace(localVarPath, "{"+"device_id"+"}", _neturl.PathEscape(datadog.ParameterToString(deviceId, "")), -1)

localVarHeaderParams := make(map[string]string)
localVarQueryParams := _neturl.Values{}
localVarFormParams := _neturl.Values{}
localVarHeaderParams["Accept"] = "application/json"

datadog.SetAuthKeys(
ctx,
&localVarHeaderParams,
[2]string{"apiKeyAuth", "DD-API-KEY"},
[2]string{"appKeyAuth", "DD-APPLICATION-KEY"},
)
req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil)
if err != nil {
return localVarReturnValue, nil, err
}

localVarHTTPResponse, err := a.Client.CallAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarReturnValue, localVarHTTPResponse, err
}

localVarBody, err := datadog.ReadBody(localVarHTTPResponse)
if err != nil {
return localVarReturnValue, localVarHTTPResponse, err
}

if localVarHTTPResponse.StatusCode >= 300 {
newErr := datadog.GenericOpenAPIError{
ErrorBody: localVarBody,
ErrorMessage: localVarHTTPResponse.Status,
}
if localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 429 {
var v APIErrorResponse
err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
return localVarReturnValue, localVarHTTPResponse, newErr
}
newErr.ErrorModel = v
}
return localVarReturnValue, localVarHTTPResponse, newErr
}

err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr := datadog.GenericOpenAPIError{
ErrorBody: localVarBody,
ErrorMessage: err.Error(),
}
return localVarReturnValue, localVarHTTPResponse, newErr
}

return localVarReturnValue, localVarHTTPResponse, nil
}

// ListDevicesOptionalParameters holds optional parameters for ListDevices.
type ListDevicesOptionalParameters struct {
PageNumber *int64
Expand Down Expand Up @@ -286,6 +357,80 @@ func (a *NetworkDeviceMonitoringApi) ListDevices(ctx _context.Context, o ...List
return localVarReturnValue, localVarHTTPResponse, nil
}

// UpdateDeviceUserTags Update the tags for a device.
// Update the tags for a device.
func (a *NetworkDeviceMonitoringApi) UpdateDeviceUserTags(ctx _context.Context, deviceId string, body ListTagsResponse) (ListTagsResponse, *_nethttp.Response, error) {
var (
localVarHTTPMethod = _nethttp.MethodPatch
localVarPostBody interface{}
localVarReturnValue ListTagsResponse
)

localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.NetworkDeviceMonitoringApi.UpdateDeviceUserTags")
if err != nil {
return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()}
}

localVarPath := localBasePath + "/api/v2/ndm/tags/devices/{device_id}"
localVarPath = strings.Replace(localVarPath, "{"+"device_id"+"}", _neturl.PathEscape(datadog.ParameterToString(deviceId, "")), -1)

localVarHeaderParams := make(map[string]string)
localVarQueryParams := _neturl.Values{}
localVarFormParams := _neturl.Values{}
localVarHeaderParams["Content-Type"] = "application/json"
localVarHeaderParams["Accept"] = "application/json"

// body params
localVarPostBody = &body
datadog.SetAuthKeys(
ctx,
&localVarHeaderParams,
[2]string{"apiKeyAuth", "DD-API-KEY"},
[2]string{"appKeyAuth", "DD-APPLICATION-KEY"},
)
req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil)
if err != nil {
return localVarReturnValue, nil, err
}

localVarHTTPResponse, err := a.Client.CallAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarReturnValue, localVarHTTPResponse, err
}

localVarBody, err := datadog.ReadBody(localVarHTTPResponse)
if err != nil {
return localVarReturnValue, localVarHTTPResponse, err
}

if localVarHTTPResponse.StatusCode >= 300 {
newErr := datadog.GenericOpenAPIError{
ErrorBody: localVarBody,
ErrorMessage: localVarHTTPResponse.Status,
}
if localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 429 {
var v APIErrorResponse
err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
return localVarReturnValue, localVarHTTPResponse, newErr
}
newErr.ErrorModel = v
}
return localVarReturnValue, localVarHTTPResponse, newErr
}

err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr := datadog.GenericOpenAPIError{
ErrorBody: localVarBody,
ErrorMessage: err.Error(),
}
return localVarReturnValue, localVarHTTPResponse, newErr
}

return localVarReturnValue, localVarHTTPResponse, nil
}

// NewNetworkDeviceMonitoringApi Returns NewNetworkDeviceMonitoringApi.
func NewNetworkDeviceMonitoringApi(client *datadog.APIClient) *NetworkDeviceMonitoringApi {
return &NetworkDeviceMonitoringApi{
Expand Down
2 changes: 2 additions & 0 deletions api/datadogV2/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,9 @@
// - [MonitorsApi.UpdateMonitorConfigPolicy]
// - [NetworkDeviceMonitoringApi.GetDevice]
// - [NetworkDeviceMonitoringApi.GetInterfaces]
// - [NetworkDeviceMonitoringApi.ListDeviceUserTags]
// - [NetworkDeviceMonitoringApi.ListDevices]
// - [NetworkDeviceMonitoringApi.UpdateDeviceUserTags]
// - [OktaIntegrationApi.CreateOktaAccount]
// - [OktaIntegrationApi.DeleteOktaAccount]
// - [OktaIntegrationApi.GetOktaAccount]
Expand Down
Loading

0 comments on commit 3b81821

Please sign in to comment.