Skip to content

Commit

Permalink
Regenerate client from commit a3c20084 of spec repo
Browse files Browse the repository at this point in the history
  • Loading branch information
ci.datadog-api-spec committed Jul 29, 2024
1 parent f4af254 commit 403a81f
Show file tree
Hide file tree
Showing 20 changed files with 842 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-29 14:10:26.061692",
"spec_repo_commit": "a3c20084"
},
"v2": {
"apigentools_version": "1.6.6",
"regenerated": "2024-07-26 19:06:16.789960",
"spec_repo_commit": "44cf4afe"
"regenerated": "2024-07-29 14:10:26.080787",
"spec_repo_commit": "a3c20084"
}
}
}
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: ListTags
parameters:
- description: The id of the device to fetch.
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: UpdateTags
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 @@ -286,6 +286,151 @@ func (a *NetworkDeviceMonitoringApi) ListDevices(ctx _context.Context, o ...List
return localVarReturnValue, localVarHTTPResponse, nil
}

// ListTags Get the list of tags for a device.
// Get the list of tags for a device.
func (a *NetworkDeviceMonitoringApi) ListTags(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.ListTags")
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
}

// UpdateTags Update the tags for a device.
// Update the tags for a device.
func (a *NetworkDeviceMonitoringApi) UpdateTags(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.UpdateTags")
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 @@ -205,6 +205,8 @@
// - [NetworkDeviceMonitoringApi.GetDevice]
// - [NetworkDeviceMonitoringApi.GetInterfaces]
// - [NetworkDeviceMonitoringApi.ListDevices]
// - [NetworkDeviceMonitoringApi.ListTags]
// - [NetworkDeviceMonitoringApi.UpdateTags]
// - [OktaIntegrationApi.CreateOktaAccount]
// - [OktaIntegrationApi.DeleteOktaAccount]
// - [OktaIntegrationApi.GetOktaAccount]
Expand Down
111 changes: 111 additions & 0 deletions api/datadogV2/model_list_tags_response.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
// This product includes software developed at Datadog (https://www.datadoghq.com/).
// Copyright 2019-Present Datadog, Inc.

package datadogV2

import (
"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
)

// ListTagsResponse List tags response.
type ListTagsResponse struct {
// The list tags response data.
Data *ListTagsResponseData `json:"data,omitempty"`
// UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct
UnparsedObject map[string]interface{} `json:"-"`
AdditionalProperties map[string]interface{}
}

// NewListTagsResponse instantiates a new ListTagsResponse object.
// This constructor will assign default values to properties that have it defined,
// and makes sure properties required by API are set, but the set of arguments
// will change when the set of required properties is changed.
func NewListTagsResponse() *ListTagsResponse {
this := ListTagsResponse{}
return &this
}

// NewListTagsResponseWithDefaults instantiates a new ListTagsResponse object.
// This constructor will only assign default values to properties that have it defined,
// but it doesn't guarantee that properties required by API are set.
func NewListTagsResponseWithDefaults() *ListTagsResponse {
this := ListTagsResponse{}
return &this
}

// GetData returns the Data field value if set, zero value otherwise.
func (o *ListTagsResponse) GetData() ListTagsResponseData {
if o == nil || o.Data == nil {
var ret ListTagsResponseData
return ret
}
return *o.Data
}

// GetDataOk returns a tuple with the Data field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *ListTagsResponse) GetDataOk() (*ListTagsResponseData, bool) {
if o == nil || o.Data == nil {
return nil, false
}
return o.Data, true
}

// HasData returns a boolean if a field has been set.
func (o *ListTagsResponse) HasData() bool {
return o != nil && o.Data != nil
}

// SetData gets a reference to the given ListTagsResponseData and assigns it to the Data field.
func (o *ListTagsResponse) SetData(v ListTagsResponseData) {
o.Data = &v
}

// MarshalJSON serializes the struct using spec logic.
func (o ListTagsResponse) MarshalJSON() ([]byte, error) {
toSerialize := map[string]interface{}{}
if o.UnparsedObject != nil {
return datadog.Marshal(o.UnparsedObject)
}
if o.Data != nil {
toSerialize["data"] = o.Data
}

for key, value := range o.AdditionalProperties {
toSerialize[key] = value
}
return datadog.Marshal(toSerialize)
}

// UnmarshalJSON deserializes the given payload.
func (o *ListTagsResponse) UnmarshalJSON(bytes []byte) (err error) {
all := struct {
Data *ListTagsResponseData `json:"data,omitempty"`
}{}
if err = datadog.Unmarshal(bytes, &all); err != nil {
return datadog.Unmarshal(bytes, &o.UnparsedObject)
}
additionalProperties := make(map[string]interface{})
if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil {
datadog.DeleteKeys(additionalProperties, &[]string{"data"})
} else {
return err
}

hasInvalidField := false
if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil {
hasInvalidField = true
}
o.Data = all.Data

if len(additionalProperties) > 0 {
o.AdditionalProperties = additionalProperties
}

if hasInvalidField {
return datadog.Unmarshal(bytes, &o.UnparsedObject)
}

return nil
}
Loading

0 comments on commit 403a81f

Please sign in to comment.