Skip to content

Commit 7f07b07

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

6 files changed

Lines changed: 148 additions & 0 deletions

File tree

.generator/schemas/v2/openapi.yaml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1012,6 +1012,13 @@ components:
10121012
required: true
10131013
schema:
10141014
type: string
1015+
MicrosoftTeamsTenantIDPathParameter:
1016+
description: Your tenant id.
1017+
in: path
1018+
name: tenant_id
1019+
required: true
1020+
schema:
1021+
type: string
10151022
MicrosoftTeamsTenantIDQueryParameter:
10161023
description: Your tenant id.
10171024
in: query
@@ -134956,6 +134963,26 @@ paths:
134956134963
tags:
134957134964
- Microsoft Teams Integration
134958134965
x-codegen-request-body-name: body
134966+
/api/v2/integration/ms-teams/configuration/user-binding/{tenant_id}:
134967+
delete:
134968+
description: Delete the user binding for a given tenant from the Datadog Microsoft Teams integration.
134969+
operationId: DeleteMSTeamsUserBinding
134970+
parameters:
134971+
- $ref: "#/components/parameters/MicrosoftTeamsTenantIDPathParameter"
134972+
responses:
134973+
"204":
134974+
description: No Content
134975+
"400":
134976+
$ref: "#/components/responses/BadRequestResponse"
134977+
"403":
134978+
$ref: "#/components/responses/ForbiddenResponse"
134979+
"412":
134980+
$ref: "#/components/responses/PreconditionFailedResponse"
134981+
"429":
134982+
$ref: "#/components/responses/TooManyRequestsResponse"
134983+
summary: Delete user binding
134984+
tags:
134985+
- Microsoft Teams Integration
134959134986
/api/v2/integration/ms-teams/configuration/workflows-webhook-handles:
134960134987
get:
134961134988
description: Get a list of all Workflows webhook handles from the Datadog Microsoft Teams integration.

api/datadogV2/api_microsoft_teams_integration.go

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,74 @@ func (a *MicrosoftTeamsIntegrationApi) CreateWorkflowsWebhookHandle(ctx _context
175175
return localVarReturnValue, localVarHTTPResponse, nil
176176
}
177177

178+
// DeleteMSTeamsUserBinding Delete user binding.
179+
// Delete the user binding for a given tenant from the Datadog Microsoft Teams integration.
180+
func (a *MicrosoftTeamsIntegrationApi) DeleteMSTeamsUserBinding(ctx _context.Context, tenantId string) (*_nethttp.Response, error) {
181+
var (
182+
localVarHTTPMethod = _nethttp.MethodDelete
183+
localVarPostBody interface{}
184+
)
185+
186+
localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.MicrosoftTeamsIntegrationApi.DeleteMSTeamsUserBinding")
187+
if err != nil {
188+
return nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()}
189+
}
190+
191+
localVarPath := localBasePath + "/api/v2/integration/ms-teams/configuration/user-binding/{tenant_id}"
192+
localVarPath = datadog.ReplacePathParameter(localVarPath, "{tenant_id}", _neturl.PathEscape(datadog.ParameterToString(tenantId, "")))
193+
194+
localVarHeaderParams := make(map[string]string)
195+
localVarQueryParams := _neturl.Values{}
196+
localVarFormParams := _neturl.Values{}
197+
localVarHeaderParams["Accept"] = "*/*"
198+
199+
if a.Client.Cfg.DelegatedTokenConfig != nil {
200+
err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig)
201+
if err != nil {
202+
return nil, err
203+
}
204+
} else {
205+
datadog.SetAuthKeys(
206+
ctx,
207+
&localVarHeaderParams,
208+
[2]string{"apiKeyAuth", "DD-API-KEY"},
209+
[2]string{"appKeyAuth", "DD-APPLICATION-KEY"},
210+
)
211+
}
212+
req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil)
213+
if err != nil {
214+
return nil, err
215+
}
216+
217+
localVarHTTPResponse, err := a.Client.CallAPI(req)
218+
if err != nil || localVarHTTPResponse == nil {
219+
return localVarHTTPResponse, err
220+
}
221+
222+
localVarBody, err := datadog.ReadBody(localVarHTTPResponse)
223+
if err != nil {
224+
return localVarHTTPResponse, err
225+
}
226+
227+
if localVarHTTPResponse.StatusCode >= 300 {
228+
newErr := datadog.GenericOpenAPIError{
229+
ErrorBody: localVarBody,
230+
ErrorMessage: localVarHTTPResponse.Status,
231+
}
232+
if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 412 || localVarHTTPResponse.StatusCode == 429 {
233+
var v APIErrorResponse
234+
err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
235+
if err != nil {
236+
return localVarHTTPResponse, newErr
237+
}
238+
newErr.ErrorModel = v
239+
}
240+
return localVarHTTPResponse, newErr
241+
}
242+
243+
return localVarHTTPResponse, nil
244+
}
245+
178246
// DeleteTenantBasedHandle Delete tenant-based handle.
179247
// Delete a tenant-based handle from the Datadog Microsoft Teams integration.
180248
func (a *MicrosoftTeamsIntegrationApi) DeleteTenantBasedHandle(ctx _context.Context, handleId string) (*_nethttp.Response, error) {

api/datadogV2/doc.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -678,6 +678,7 @@
678678
// - [MetricsApi.UpdateTagIndexingRule]
679679
// - [MicrosoftTeamsIntegrationApi.CreateTenantBasedHandle]
680680
// - [MicrosoftTeamsIntegrationApi.CreateWorkflowsWebhookHandle]
681+
// - [MicrosoftTeamsIntegrationApi.DeleteMSTeamsUserBinding]
681682
// - [MicrosoftTeamsIntegrationApi.DeleteTenantBasedHandle]
682683
// - [MicrosoftTeamsIntegrationApi.DeleteWorkflowsWebhookHandle]
683684
// - [MicrosoftTeamsIntegrationApi.GetChannelByName]
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// Delete user binding returns "No Content" response
2+
3+
package main
4+
5+
import (
6+
"context"
7+
"fmt"
8+
"os"
9+
10+
"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
11+
"github.com/DataDog/datadog-api-client-go/v2/api/datadogV2"
12+
)
13+
14+
func main() {
15+
ctx := datadog.NewDefaultContext(context.Background())
16+
configuration := datadog.NewConfiguration()
17+
apiClient := datadog.NewAPIClient(configuration)
18+
api := datadogV2.NewMicrosoftTeamsIntegrationApi(apiClient)
19+
r, err := api.DeleteMSTeamsUserBinding(ctx, "tenant_id")
20+
21+
if err != nil {
22+
fmt.Fprintf(os.Stderr, "Error when calling `MicrosoftTeamsIntegrationApi.DeleteMSTeamsUserBinding`: %v\n", err)
23+
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
24+
}
25+
}

tests/scenarios/features/v2/microsoft_teams_integration.feature

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,27 @@ Feature: Microsoft Teams Integration
146146
When the request is sent
147147
Then the response status is 204 OK
148148

149+
@generated @skip @team:DataDog/chat-integrations
150+
Scenario: Delete user binding returns "Bad Request" response
151+
Given new "DeleteMSTeamsUserBinding" request
152+
And request contains "tenant_id" parameter from "REPLACE.ME"
153+
When the request is sent
154+
Then the response status is 400 Bad Request
155+
156+
@generated @skip @team:DataDog/chat-integrations
157+
Scenario: Delete user binding returns "Failed Precondition" response
158+
Given new "DeleteMSTeamsUserBinding" request
159+
And request contains "tenant_id" parameter from "REPLACE.ME"
160+
When the request is sent
161+
Then the response status is 412 Failed Precondition
162+
163+
@generated @skip @team:DataDog/chat-integrations
164+
Scenario: Delete user binding returns "No Content" response
165+
Given new "DeleteMSTeamsUserBinding" request
166+
And request contains "tenant_id" parameter from "REPLACE.ME"
167+
When the request is sent
168+
Then the response status is 204 No Content
169+
149170
@team:DataDog/chat-integrations
150171
Scenario: Delete workflow webhook handle returns "OK" response
151172
Given there is a valid "workflows_webhook_handle" in the system

tests/scenarios/features/v2/undo.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3529,6 +3529,12 @@
35293529
"type": "idempotent"
35303530
}
35313531
},
3532+
"DeleteMSTeamsUserBinding": {
3533+
"tag": "Microsoft Teams Integration",
3534+
"undo": {
3535+
"type": "idempotent"
3536+
}
3537+
},
35323538
"ListWorkflowsWebhookHandles": {
35333539
"tag": "Microsoft Teams Integration",
35343540
"undo": {

0 commit comments

Comments
 (0)