Skip to content

Commit d507c38

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Regenerate client from commit fc1fa35 of spec repo (DataDog#4230)
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
1 parent f44a84b commit d507c38

10 files changed

Lines changed: 555 additions & 0 deletions

File tree

.generator/schemas/v2/openapi.yaml

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1780,6 +1780,14 @@ components:
17801780
required: false
17811781
schema:
17821782
type: boolean
1783+
SlackUserUuidQueryParameter:
1784+
description: The UUID of the Datadog user to list Slack bindings for.
1785+
in: query
1786+
name: user_uuid
1787+
required: true
1788+
schema:
1789+
format: uuid
1790+
type: string
17831791
SloID:
17841792
description: The ID of the SLO.
17851793
in: path
@@ -89039,6 +89047,37 @@ components:
8903989047
required:
8904089048
- slackTrigger
8904189049
type: object
89050+
SlackUserBindingData:
89051+
description: Slack team ID data from a response.
89052+
properties:
89053+
id:
89054+
description: The Slack team ID.
89055+
example: "T01234567"
89056+
type: string
89057+
type:
89058+
$ref: "#/components/schemas/SlackUserBindingType"
89059+
type: object
89060+
SlackUserBindingType:
89061+
default: team_id
89062+
description: Slack user binding resource type.
89063+
enum:
89064+
- team_id
89065+
example: team_id
89066+
type: string
89067+
x-enum-varnames:
89068+
- TEAM_ID
89069+
SlackUserBindingsResponse:
89070+
description: Response with a list of Slack user bindings.
89071+
properties:
89072+
data:
89073+
description: An array of Slack user bindings.
89074+
example: [{"id": "T01234567", "type": "team_id"}, {"id": "T09876543", "type": "team_id"}]
89075+
items:
89076+
$ref: "#/components/schemas/SlackUserBindingData"
89077+
type: array
89078+
required:
89079+
- data
89080+
type: object
8904289081
SloDataSource:
8904389082
default: slo
8904489083
description: A data source for SLO queries.
@@ -136401,6 +136440,36 @@ paths:
136401136440
summary: List ServiceNow users
136402136441
tags:
136403136442
- ServiceNow Integration
136443+
/api/v2/integration/slack/user-bindings:
136444+
get:
136445+
description: List all Slack user bindings for a given Datadog user from the Datadog Slack integration.
136446+
operationId: ListSlackUserBindings
136447+
parameters:
136448+
- $ref: "#/components/parameters/SlackUserUuidQueryParameter"
136449+
responses:
136450+
"200":
136451+
content:
136452+
application/json:
136453+
examples:
136454+
default:
136455+
value:
136456+
data:
136457+
- id: T01234567
136458+
type: team_id
136459+
- id: T09876543
136460+
type: team_id
136461+
schema:
136462+
$ref: "#/components/schemas/SlackUserBindingsResponse"
136463+
description: OK
136464+
"400":
136465+
$ref: "#/components/responses/BadRequestResponse"
136466+
"403":
136467+
$ref: "#/components/responses/ForbiddenResponse"
136468+
"429":
136469+
$ref: "#/components/responses/TooManyRequestsResponse"
136470+
summary: List Slack user bindings
136471+
tags:
136472+
- Slack Integration
136404136473
/api/v2/integration/statuspage/account:
136405136474
delete:
136406136475
description: Delete the Statuspage account configured for your organization.
@@ -186271,6 +186340,13 @@ tags:
186271186340
name: Service Level Objectives
186272186341
- description: Manage your ServiceNow Integration. ServiceNow is a cloud-based platform that helps organizations manage digital workflows for enterprise operations.
186273186342
name: ServiceNow Integration
186343+
- description: |-
186344+
Configure your [Datadog Slack integration](https://docs.datadoghq.com/integrations/slack/)
186345+
directly through the Datadog API.
186346+
externalDocs:
186347+
description: For more information about the Datadog Slack integration, see the integration page.
186348+
url: https://docs.datadoghq.com/integrations/slack/
186349+
name: Slack Integration
186274186350
- description: |-
186275186351
API to create, update, retrieve, and delete Software Catalog entities.
186276186352
externalDocs:
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
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+
_context "context"
9+
_nethttp "net/http"
10+
_neturl "net/url"
11+
12+
"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
13+
"github.com/google/uuid"
14+
)
15+
16+
// SlackIntegrationApi service type
17+
type SlackIntegrationApi datadog.Service
18+
19+
// ListSlackUserBindings List Slack user bindings.
20+
// List all Slack user bindings for a given Datadog user from the Datadog Slack integration.
21+
func (a *SlackIntegrationApi) ListSlackUserBindings(ctx _context.Context, userUuid uuid.UUID) (SlackUserBindingsResponse, *_nethttp.Response, error) {
22+
var (
23+
localVarHTTPMethod = _nethttp.MethodGet
24+
localVarPostBody interface{}
25+
localVarReturnValue SlackUserBindingsResponse
26+
)
27+
28+
localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.SlackIntegrationApi.ListSlackUserBindings")
29+
if err != nil {
30+
return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()}
31+
}
32+
33+
localVarPath := localBasePath + "/api/v2/integration/slack/user-bindings"
34+
35+
localVarHeaderParams := make(map[string]string)
36+
localVarQueryParams := _neturl.Values{}
37+
localVarFormParams := _neturl.Values{}
38+
localVarQueryParams.Add("user_uuid", datadog.ParameterToString(userUuid, ""))
39+
localVarHeaderParams["Accept"] = "application/json"
40+
41+
if a.Client.Cfg.DelegatedTokenConfig != nil {
42+
err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig)
43+
if err != nil {
44+
return localVarReturnValue, nil, err
45+
}
46+
} else {
47+
datadog.SetAuthKeys(
48+
ctx,
49+
&localVarHeaderParams,
50+
[2]string{"apiKeyAuth", "DD-API-KEY"},
51+
[2]string{"appKeyAuth", "DD-APPLICATION-KEY"},
52+
)
53+
}
54+
req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil)
55+
if err != nil {
56+
return localVarReturnValue, nil, err
57+
}
58+
59+
localVarHTTPResponse, err := a.Client.CallAPI(req)
60+
if err != nil || localVarHTTPResponse == nil {
61+
return localVarReturnValue, localVarHTTPResponse, err
62+
}
63+
64+
localVarBody, err := datadog.ReadBody(localVarHTTPResponse)
65+
if err != nil {
66+
return localVarReturnValue, localVarHTTPResponse, err
67+
}
68+
69+
if localVarHTTPResponse.StatusCode >= 300 {
70+
newErr := datadog.GenericOpenAPIError{
71+
ErrorBody: localVarBody,
72+
ErrorMessage: localVarHTTPResponse.Status,
73+
}
74+
if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 429 {
75+
var v APIErrorResponse
76+
err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
77+
if err != nil {
78+
return localVarReturnValue, localVarHTTPResponse, newErr
79+
}
80+
newErr.ErrorModel = v
81+
}
82+
return localVarReturnValue, localVarHTTPResponse, newErr
83+
}
84+
85+
err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
86+
if err != nil {
87+
newErr := datadog.GenericOpenAPIError{
88+
ErrorBody: localVarBody,
89+
ErrorMessage: err.Error(),
90+
}
91+
return localVarReturnValue, localVarHTTPResponse, newErr
92+
}
93+
94+
return localVarReturnValue, localVarHTTPResponse, nil
95+
}
96+
97+
// NewSlackIntegrationApi Returns NewSlackIntegrationApi.
98+
func NewSlackIntegrationApi(client *datadog.APIClient) *SlackIntegrationApi {
99+
return &SlackIntegrationApi{
100+
Client: client,
101+
}
102+
}

api/datadogV2/doc.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1112,6 +1112,7 @@
11121112
// - [ServiceNowIntegrationApi.ListServiceNowTemplates]
11131113
// - [ServiceNowIntegrationApi.ListServiceNowUsers]
11141114
// - [ServiceNowIntegrationApi.UpdateServiceNowTemplate]
1115+
// - [SlackIntegrationApi.ListSlackUserBindings]
11151116
// - [SoftwareCatalogApi.DeleteCatalogEntity]
11161117
// - [SoftwareCatalogApi.DeleteCatalogKind]
11171118
// - [SoftwareCatalogApi.ListCatalogEntity]
Lines changed: 151 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,151 @@
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+
"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
9+
)
10+
11+
// SlackUserBindingData Slack team ID data from a response.
12+
type SlackUserBindingData struct {
13+
// The Slack team ID.
14+
Id *string `json:"id,omitempty"`
15+
// Slack user binding resource type.
16+
Type *SlackUserBindingType `json:"type,omitempty"`
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+
// NewSlackUserBindingData instantiates a new SlackUserBindingData 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 NewSlackUserBindingData() *SlackUserBindingData {
27+
this := SlackUserBindingData{}
28+
var typeVar SlackUserBindingType = SLACKUSERBINDINGTYPE_TEAM_ID
29+
this.Type = &typeVar
30+
return &this
31+
}
32+
33+
// NewSlackUserBindingDataWithDefaults instantiates a new SlackUserBindingData object.
34+
// This constructor will only assign default values to properties that have it defined,
35+
// but it doesn't guarantee that properties required by API are set.
36+
func NewSlackUserBindingDataWithDefaults() *SlackUserBindingData {
37+
this := SlackUserBindingData{}
38+
var typeVar SlackUserBindingType = SLACKUSERBINDINGTYPE_TEAM_ID
39+
this.Type = &typeVar
40+
return &this
41+
}
42+
43+
// GetId returns the Id field value if set, zero value otherwise.
44+
func (o *SlackUserBindingData) GetId() string {
45+
if o == nil || o.Id == nil {
46+
var ret string
47+
return ret
48+
}
49+
return *o.Id
50+
}
51+
52+
// GetIdOk returns a tuple with the Id field value if set, nil otherwise
53+
// and a boolean to check if the value has been set.
54+
func (o *SlackUserBindingData) GetIdOk() (*string, bool) {
55+
if o == nil || o.Id == nil {
56+
return nil, false
57+
}
58+
return o.Id, true
59+
}
60+
61+
// HasId returns a boolean if a field has been set.
62+
func (o *SlackUserBindingData) HasId() bool {
63+
return o != nil && o.Id != nil
64+
}
65+
66+
// SetId gets a reference to the given string and assigns it to the Id field.
67+
func (o *SlackUserBindingData) SetId(v string) {
68+
o.Id = &v
69+
}
70+
71+
// GetType returns the Type field value if set, zero value otherwise.
72+
func (o *SlackUserBindingData) GetType() SlackUserBindingType {
73+
if o == nil || o.Type == nil {
74+
var ret SlackUserBindingType
75+
return ret
76+
}
77+
return *o.Type
78+
}
79+
80+
// GetTypeOk returns a tuple with the Type field value if set, nil otherwise
81+
// and a boolean to check if the value has been set.
82+
func (o *SlackUserBindingData) GetTypeOk() (*SlackUserBindingType, bool) {
83+
if o == nil || o.Type == nil {
84+
return nil, false
85+
}
86+
return o.Type, true
87+
}
88+
89+
// HasType returns a boolean if a field has been set.
90+
func (o *SlackUserBindingData) HasType() bool {
91+
return o != nil && o.Type != nil
92+
}
93+
94+
// SetType gets a reference to the given SlackUserBindingType and assigns it to the Type field.
95+
func (o *SlackUserBindingData) SetType(v SlackUserBindingType) {
96+
o.Type = &v
97+
}
98+
99+
// MarshalJSON serializes the struct using spec logic.
100+
func (o SlackUserBindingData) MarshalJSON() ([]byte, error) {
101+
toSerialize := map[string]interface{}{}
102+
if o.UnparsedObject != nil {
103+
return datadog.Marshal(o.UnparsedObject)
104+
}
105+
if o.Id != nil {
106+
toSerialize["id"] = o.Id
107+
}
108+
if o.Type != nil {
109+
toSerialize["type"] = o.Type
110+
}
111+
112+
for key, value := range o.AdditionalProperties {
113+
toSerialize[key] = value
114+
}
115+
return datadog.Marshal(toSerialize)
116+
}
117+
118+
// UnmarshalJSON deserializes the given payload.
119+
func (o *SlackUserBindingData) UnmarshalJSON(bytes []byte) (err error) {
120+
all := struct {
121+
Id *string `json:"id,omitempty"`
122+
Type *SlackUserBindingType `json:"type,omitempty"`
123+
}{}
124+
if err = datadog.Unmarshal(bytes, &all); err != nil {
125+
return datadog.Unmarshal(bytes, &o.UnparsedObject)
126+
}
127+
additionalProperties := make(map[string]interface{})
128+
if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil {
129+
datadog.DeleteKeys(additionalProperties, &[]string{"id", "type"})
130+
} else {
131+
return err
132+
}
133+
134+
hasInvalidField := false
135+
o.Id = all.Id
136+
if all.Type != nil && !all.Type.IsValid() {
137+
hasInvalidField = true
138+
} else {
139+
o.Type = all.Type
140+
}
141+
142+
if len(additionalProperties) > 0 {
143+
o.AdditionalProperties = additionalProperties
144+
}
145+
146+
if hasInvalidField {
147+
return datadog.Unmarshal(bytes, &o.UnparsedObject)
148+
}
149+
150+
return nil
151+
}

0 commit comments

Comments
 (0)