diff --git a/.apigentools-info b/.apigentools-info index d1ad1bdb732..454a4786683 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.6", - "regenerated": "2024-10-01 14:24:25.145296", - "spec_repo_commit": "d90ee2ef" + "regenerated": "2024-10-01 16:17:33.912590", + "spec_repo_commit": "65dbf403" }, "v2": { "apigentools_version": "1.6.6", - "regenerated": "2024-10-01 14:24:25.159865", - "spec_repo_commit": "d90ee2ef" + "regenerated": "2024-10-01 16:17:33.927399", + "spec_repo_commit": "65dbf403" } } } \ No newline at end of file diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index ce325fb6281..63eb2ce8443 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -451,6 +451,48 @@ components: required: true schema: type: string + MicrosoftTeamsChannelNamePathParameter: + description: Your channel name. + in: path + name: channel_name + required: true + schema: + type: string + MicrosoftTeamsHandleIDPathParameter: + description: Your handle id. + in: path + name: handle_id + required: true + schema: + type: string + MicrosoftTeamsHandleNamePathParameter: + description: Your handle name. + in: path + name: handle_name + required: true + schema: + type: string + MicrosoftTeamsTeamNamePathParameter: + description: Your team name. + in: path + name: team_name + required: true + schema: + type: string + MicrosoftTeamsTenantIDQueryParameter: + description: Your tenant id. + in: query + name: tenant_id + required: false + schema: + type: string + MicrosoftTeamsTenantNamePathParameter: + description: Your tenant name. + in: path + name: tenant_name + required: true + schema: + type: string OpsgenieServiceIDPathParameter: description: The UUID of the service. in: path @@ -691,6 +733,12 @@ components: schema: $ref: '#/components/schemas/APIErrorResponse' description: Not Found + PreconditionFailedResponse: + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Failed Precondition SpansBadRequestResponse: content: application/json: @@ -14761,6 +14809,276 @@ components: - data_source - query type: object + MicrosoftTeamsApiHandleAttributes: + description: Handle attributes. + properties: + channel_id: + description: Channel id. + example: fake-channel-id + maxLength: 255 + type: string + name: + description: Handle name. + example: fake-handle-name + maxLength: 255 + type: string + team_id: + description: Team id. + example: 00000000-0000-0000-0000-000000000000 + maxLength: 255 + type: string + tenant_id: + description: Tenant id. + example: 00000000-0000-0000-0000-000000000001 + maxLength: 255 + type: string + type: object + MicrosoftTeamsApiHandleInfoResponse: + description: Response of a handle. + properties: + data: + $ref: '#/components/schemas/MicrosoftTeamsApiHandleInfoResponseData' + type: object + MicrosoftTeamsApiHandleInfoResponseAttributes: + description: Handle attributes. + properties: + channel_id: + description: Channel id. + example: fake-channel-id + maxLength: 255 + type: string + channel_name: + description: Channel name. + example: fake-channel-name + maxLength: 255 + type: string + name: + description: Handle name. + example: fake-handle-name + maxLength: 255 + type: string + team_id: + description: Team id. + example: 00000000-0000-0000-0000-000000000000 + maxLength: 255 + type: string + team_name: + description: Team name. + example: fake-team-name + maxLength: 255 + type: string + tenant_id: + description: Tenant id. + example: 00000000-0000-0000-0000-000000000001 + maxLength: 255 + type: string + tenant_name: + description: Tenant name. + example: fake-tenant-name + maxLength: 255 + type: string + type: object + MicrosoftTeamsApiHandleInfoResponseData: + description: Handle data from a response. + properties: + attributes: + $ref: '#/components/schemas/MicrosoftTeamsApiHandleInfoResponseAttributes' + id: + description: The ID of the handle. + example: 596da4af-0563-4097-90ff-07230c3f9db3 + maxLength: 100 + minLength: 1 + type: string + type: + $ref: '#/components/schemas/MicrosoftTeamsApiHandleInfoType' + type: object + MicrosoftTeamsApiHandleInfoType: + default: ms-teams-handle-info + description: Handle resource type. + enum: + - ms-teams-handle-info + example: ms-teams-handle-info + type: string + x-enum-varnames: + - MS_TEAMS_HANDLE_INFO + MicrosoftTeamsApiHandleRequestAttributes: + description: Handle attributes. + properties: + channel_id: + description: Channel id. + example: fake-channel-id + maxLength: 255 + type: string + name: + description: Handle name. + example: fake-handle-name + maxLength: 255 + type: string + team_id: + description: Team id. + example: 00000000-0000-0000-0000-000000000000 + maxLength: 255 + type: string + tenant_id: + description: Tenant id. + example: 00000000-0000-0000-0000-000000000001 + maxLength: 255 + type: string + required: + - name + - channel_id + - team_id + - tenant_id + type: object + MicrosoftTeamsApiHandleRequestData: + description: Handle data from a response. + properties: + attributes: + $ref: '#/components/schemas/MicrosoftTeamsApiHandleRequestAttributes' + type: + $ref: '#/components/schemas/MicrosoftTeamsApiHandleType' + required: + - type + - attributes + type: object + MicrosoftTeamsApiHandleResponseData: + description: Handle data from a response. + properties: + attributes: + $ref: '#/components/schemas/MicrosoftTeamsApiHandleAttributes' + id: + description: The ID of the handle. + example: 596da4af-0563-4097-90ff-07230c3f9db3 + maxLength: 100 + minLength: 1 + type: string + type: + $ref: '#/components/schemas/MicrosoftTeamsApiHandleType' + type: object + MicrosoftTeamsApiHandleType: + default: handle + description: Specifies the handle resource type. + enum: + - handle + example: handle + type: string + x-enum-varnames: + - HANDLE + MicrosoftTeamsApiHandlesResponse: + description: Response with a list of handles. + properties: + data: + description: An array of handles. + example: + - attributes: + channelId: 19:b41k24b14bn1nwffkernfkwrnfneubgkr@thread.tacv2 + channelName: General + name: general-handle + teamId: 00000000-0000-0000-0000-000000000000 + teamName: Example Team + tenantId: 00000000-0000-0000-0000-000000000001 + tenantName: Company, Inc. + id: 596da4af-0563-4097-90ff-07230c3f9db3 + type: ms-teams-handle-info + - attributes: + channelId: 19:b41k24b14bn1nwffkernfkwrnfneubgk1@thread.tacv2 + channelName: General2 + name: general-handle-2 + teamId: 00000000-0000-0000-0000-000000000002 + teamName: Example Team 2 + tenantId: 00000000-0000-0000-0000-000000000003 + tenantName: Company, Inc. + id: 596da4af-0563-4097-90ff-07230c3f9db4 + type: ms-teams-handle-info + items: + $ref: '#/components/schemas/MicrosoftTeamsApiHandleInfoResponseData' + type: array + required: + - data + type: object + MicrosoftTeamsChannelInfoResponseAttributes: + description: Channel attributes. + properties: + is_primary: + description: Indicates if this is the primary channel. + example: true + maxLength: 255 + type: boolean + team_id: + description: Team id. + example: 00000000-0000-0000-0000-000000000000 + maxLength: 255 + type: string + tenant_id: + description: Tenant id. + example: 00000000-0000-0000-0000-000000000001 + maxLength: 255 + type: string + type: object + MicrosoftTeamsChannelInfoResponseData: + description: Channel data from a response. + properties: + attributes: + $ref: '#/components/schemas/MicrosoftTeamsChannelInfoResponseAttributes' + id: + description: The ID of the channel. + example: 19:b41k24b14bn1nwffkernfkwrnfneubgkr@thread.tacv2 + maxLength: 255 + minLength: 1 + type: string + type: + $ref: '#/components/schemas/MicrosoftTeamsChannelInfoType' + type: object + MicrosoftTeamsChannelInfoType: + default: ms-teams-channel-info + description: Channel info resource type. + enum: + - ms-teams-channel-info + example: ms-teams-channel-info + type: string + x-enum-varnames: + - MS_TEAMS_CHANNEL_INFO + MicrosoftTeamsCreateApiHandleRequest: + description: Create handle request. + properties: + data: + $ref: '#/components/schemas/MicrosoftTeamsApiHandleRequestData' + required: + - data + type: object + MicrosoftTeamsCreateApiHandleResponse: + description: Response of a handle. + properties: + data: + $ref: '#/components/schemas/MicrosoftTeamsApiHandleResponseData' + required: + - data + type: object + MicrosoftTeamsGetChannelByNameResponse: + description: Response with channel, team, and tenant ID information. + properties: + data: + $ref: '#/components/schemas/MicrosoftTeamsChannelInfoResponseData' + type: object + MicrosoftTeamsUpdateApiHandleRequest: + description: Update handle request. + properties: + data: + $ref: '#/components/schemas/MicrosoftTeamsUpdateApiHandleRequestData' + required: + - data + type: object + MicrosoftTeamsUpdateApiHandleRequestData: + description: Handle data from a response. + properties: + attributes: + $ref: '#/components/schemas/MicrosoftTeamsApiHandleAttributes' + type: + $ref: '#/components/schemas/MicrosoftTeamsApiHandleType' + required: + - type + - attributes + type: object MonitorConfigPolicyAttributeCreateRequest: description: Policy and policy type for a monitor configuration policy. properties: @@ -30196,6 +30514,200 @@ paths: operator: OR permissions: - gcp_configuration_edit + /api/v2/integration/ms-teams/configuration/channel/{tenant_name}/{team_name}/{channel_name}: + get: + description: Get the tenant, team, and channel ID of a channel in the Datadog + Microsoft Teams integration. + operationId: GetChannelByName + parameters: + - $ref: '#/components/parameters/MicrosoftTeamsTenantNamePathParameter' + - $ref: '#/components/parameters/MicrosoftTeamsTeamNamePathParameter' + - $ref: '#/components/parameters/MicrosoftTeamsChannelNamePathParameter' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/MicrosoftTeamsGetChannelByNameResponse' + description: OK + '400': + $ref: '#/components/responses/BadRequestResponse' + '403': + $ref: '#/components/responses/ForbiddenResponse' + '404': + $ref: '#/components/responses/NotFoundResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Get channel information by name + tags: + - Microsoft Teams Integration + /api/v2/integration/ms-teams/configuration/tenant-based-handles: + get: + description: Get a list of all handles from the Datadog Microsoft Teams integration. + operationId: ListApiHandles + parameters: + - $ref: '#/components/parameters/MicrosoftTeamsTenantIDQueryParameter' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/MicrosoftTeamsApiHandlesResponse' + description: OK + '400': + $ref: '#/components/responses/BadRequestResponse' + '403': + $ref: '#/components/responses/ForbiddenResponse' + '404': + $ref: '#/components/responses/NotFoundResponse' + '412': + $ref: '#/components/responses/PreconditionFailedResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Get all handles + tags: + - Microsoft Teams Integration + post: + description: Create a handle in the Datadog Microsoft Teams integration. + operationId: CreateApiHandle + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/MicrosoftTeamsCreateApiHandleRequest' + description: Handle payload. + required: true + responses: + '201': + content: + application/json: + schema: + $ref: '#/components/schemas/MicrosoftTeamsCreateApiHandleResponse' + description: CREATED + '400': + $ref: '#/components/responses/BadRequestResponse' + '403': + $ref: '#/components/responses/ForbiddenResponse' + '404': + $ref: '#/components/responses/NotFoundResponse' + '409': + $ref: '#/components/responses/ConflictResponse' + '412': + $ref: '#/components/responses/PreconditionFailedResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Create handle + tags: + - Microsoft Teams Integration + x-codegen-request-body-name: body + /api/v2/integration/ms-teams/configuration/tenant-based-handles/name/{handle_name}: + get: + description: Get the tenant, team, and channel information of a handle by name + from the Datadog Microsoft Teams integration. + operationId: GetApiHandleByName + parameters: + - $ref: '#/components/parameters/MicrosoftTeamsHandleNamePathParameter' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/MicrosoftTeamsApiHandleInfoResponse' + description: OK + '400': + $ref: '#/components/responses/BadRequestResponse' + '403': + $ref: '#/components/responses/ForbiddenResponse' + '404': + $ref: '#/components/responses/NotFoundResponse' + '412': + $ref: '#/components/responses/PreconditionFailedResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Get handle information by name + tags: + - Microsoft Teams Integration + /api/v2/integration/ms-teams/configuration/tenant-based-handles/{handle_id}: + delete: + description: Delete a handle from the Datadog Microsoft Teams integration. + operationId: DeleteApiHandle + parameters: + - $ref: '#/components/parameters/MicrosoftTeamsHandleIDPathParameter' + responses: + '204': + description: OK + '400': + $ref: '#/components/responses/BadRequestResponse' + '403': + $ref: '#/components/responses/ForbiddenResponse' + '412': + $ref: '#/components/responses/PreconditionFailedResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Delete handle + tags: + - Microsoft Teams Integration + get: + description: Get the tenant, team, and channel information of a handle from + the Datadog Microsoft Teams integration. + operationId: GetApiHandle + parameters: + - $ref: '#/components/parameters/MicrosoftTeamsHandleIDPathParameter' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/MicrosoftTeamsApiHandleInfoResponse' + description: OK + '400': + $ref: '#/components/responses/BadRequestResponse' + '403': + $ref: '#/components/responses/ForbiddenResponse' + '404': + $ref: '#/components/responses/NotFoundResponse' + '412': + $ref: '#/components/responses/PreconditionFailedResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Get handle information + tags: + - Microsoft Teams Integration + patch: + description: Update a handle from the Datadog Microsoft Teams integration. + operationId: UpdateApiHandle + parameters: + - $ref: '#/components/parameters/MicrosoftTeamsHandleIDPathParameter' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/MicrosoftTeamsUpdateApiHandleRequest' + description: Opsgenie service payload. + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/MicrosoftTeamsApiHandleInfoResponse' + description: OK + '400': + $ref: '#/components/responses/BadRequestResponse' + '403': + $ref: '#/components/responses/ForbiddenResponse' + '404': + $ref: '#/components/responses/NotFoundResponse' + '409': + $ref: '#/components/responses/ConflictResponse' + '412': + $ref: '#/components/responses/PreconditionFailedResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Update handle + tags: + - Microsoft Teams Integration + x-codegen-request-body-name: body /api/v2/integration/opsgenie/services: get: description: Get a list of all services from the Datadog Opsgenie integration. @@ -40890,6 +41402,15 @@ tags: Tags for Metrics` permission.\n\nSee the [Metrics page](https://docs.datadoghq.com/metrics/) for more information." name: Metrics +- description: 'Configure your [Datadog Microsoft Teams integration](https://docs.datadoghq.com/integrations/microsoft_teams/) + + directly through the Datadog API. Note: These endpoints do not support legacy + connector handles.' + externalDocs: + description: For more information about the Datadog Microsoft Teams integration, + see the integration page. + url: https://docs.datadoghq.com/integrations/microsoft_teams/ + name: Microsoft Teams Integration - description: '[Monitors](https://docs.datadoghq.com/monitors) allow you to watch a metric or check that you care about and diff --git a/api/datadogV2/api_microsoft_teams_integration.go b/api/datadogV2/api_microsoft_teams_integration.go new file mode 100644 index 00000000000..ae26bc290a3 --- /dev/null +++ b/api/datadogV2/api_microsoft_teams_integration.go @@ -0,0 +1,545 @@ +// 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 ( + _context "context" + _nethttp "net/http" + _neturl "net/url" + "strings" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// MicrosoftTeamsIntegrationApi service type +type MicrosoftTeamsIntegrationApi datadog.Service + +// CreateApiHandle Create handle. +// Create a handle in the Datadog Microsoft Teams integration. +func (a *MicrosoftTeamsIntegrationApi) CreateApiHandle(ctx _context.Context, body MicrosoftTeamsCreateApiHandleRequest) (MicrosoftTeamsCreateApiHandleResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarReturnValue MicrosoftTeamsCreateApiHandleResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.MicrosoftTeamsIntegrationApi.CreateApiHandle") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/integration/ms-teams/configuration/tenant-based-handles" + + 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 == 400 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 409 || localVarHTTPResponse.StatusCode == 412 || 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 +} + +// DeleteApiHandle Delete handle. +// Delete a handle from the Datadog Microsoft Teams integration. +func (a *MicrosoftTeamsIntegrationApi) DeleteApiHandle(ctx _context.Context, handleId string) (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodDelete + localVarPostBody interface{} + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.MicrosoftTeamsIntegrationApi.DeleteApiHandle") + if err != nil { + return nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/integration/ms-teams/configuration/tenant-based-handles/{handle_id}" + localVarPath = strings.Replace(localVarPath, "{"+"handle_id"+"}", _neturl.PathEscape(datadog.ParameterToString(handleId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "*/*" + + 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 nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 412 || localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +// GetApiHandle Get handle information. +// Get the tenant, team, and channel information of a handle from the Datadog Microsoft Teams integration. +func (a *MicrosoftTeamsIntegrationApi) GetApiHandle(ctx _context.Context, handleId string) (MicrosoftTeamsApiHandleInfoResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue MicrosoftTeamsApiHandleInfoResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.MicrosoftTeamsIntegrationApi.GetApiHandle") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/integration/ms-teams/configuration/tenant-based-handles/{handle_id}" + localVarPath = strings.Replace(localVarPath, "{"+"handle_id"+"}", _neturl.PathEscape(datadog.ParameterToString(handleId, "")), -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 == 400 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 412 || 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 +} + +// GetApiHandleByName Get handle information by name. +// Get the tenant, team, and channel information of a handle by name from the Datadog Microsoft Teams integration. +func (a *MicrosoftTeamsIntegrationApi) GetApiHandleByName(ctx _context.Context, handleName string) (MicrosoftTeamsApiHandleInfoResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue MicrosoftTeamsApiHandleInfoResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.MicrosoftTeamsIntegrationApi.GetApiHandleByName") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/integration/ms-teams/configuration/tenant-based-handles/name/{handle_name}" + localVarPath = strings.Replace(localVarPath, "{"+"handle_name"+"}", _neturl.PathEscape(datadog.ParameterToString(handleName, "")), -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 == 400 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 412 || 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 +} + +// GetChannelByName Get channel information by name. +// Get the tenant, team, and channel ID of a channel in the Datadog Microsoft Teams integration. +func (a *MicrosoftTeamsIntegrationApi) GetChannelByName(ctx _context.Context, tenantName string, teamName string, channelName string) (MicrosoftTeamsGetChannelByNameResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue MicrosoftTeamsGetChannelByNameResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.MicrosoftTeamsIntegrationApi.GetChannelByName") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/integration/ms-teams/configuration/channel/{tenant_name}/{team_name}/{channel_name}" + localVarPath = strings.Replace(localVarPath, "{"+"tenant_name"+"}", _neturl.PathEscape(datadog.ParameterToString(tenantName, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"team_name"+"}", _neturl.PathEscape(datadog.ParameterToString(teamName, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"channel_name"+"}", _neturl.PathEscape(datadog.ParameterToString(channelName, "")), -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 == 400 || 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 +} + +// ListApiHandlesOptionalParameters holds optional parameters for ListApiHandles. +type ListApiHandlesOptionalParameters struct { + TenantId *string +} + +// NewListApiHandlesOptionalParameters creates an empty struct for parameters. +func NewListApiHandlesOptionalParameters() *ListApiHandlesOptionalParameters { + this := ListApiHandlesOptionalParameters{} + return &this +} + +// WithTenantId sets the corresponding parameter name and returns the struct. +func (r *ListApiHandlesOptionalParameters) WithTenantId(tenantId string) *ListApiHandlesOptionalParameters { + r.TenantId = &tenantId + return r +} + +// ListApiHandles Get all handles. +// Get a list of all handles from the Datadog Microsoft Teams integration. +func (a *MicrosoftTeamsIntegrationApi) ListApiHandles(ctx _context.Context, o ...ListApiHandlesOptionalParameters) (MicrosoftTeamsApiHandlesResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue MicrosoftTeamsApiHandlesResponse + optionalParams ListApiHandlesOptionalParameters + ) + + if len(o) > 1 { + return localVarReturnValue, nil, datadog.ReportError("only one argument of type ListApiHandlesOptionalParameters is allowed") + } + if len(o) == 1 { + optionalParams = o[0] + } + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.MicrosoftTeamsIntegrationApi.ListApiHandles") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/integration/ms-teams/configuration/tenant-based-handles" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if optionalParams.TenantId != nil { + localVarQueryParams.Add("tenant_id", datadog.ParameterToString(*optionalParams.TenantId, "")) + } + 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 == 400 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 412 || 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 +} + +// UpdateApiHandle Update handle. +// Update a handle from the Datadog Microsoft Teams integration. +func (a *MicrosoftTeamsIntegrationApi) UpdateApiHandle(ctx _context.Context, handleId string, body MicrosoftTeamsUpdateApiHandleRequest) (MicrosoftTeamsApiHandleInfoResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPatch + localVarPostBody interface{} + localVarReturnValue MicrosoftTeamsApiHandleInfoResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.MicrosoftTeamsIntegrationApi.UpdateApiHandle") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/integration/ms-teams/configuration/tenant-based-handles/{handle_id}" + localVarPath = strings.Replace(localVarPath, "{"+"handle_id"+"}", _neturl.PathEscape(datadog.ParameterToString(handleId, "")), -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 == 400 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 409 || localVarHTTPResponse.StatusCode == 412 || 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 +} + +// NewMicrosoftTeamsIntegrationApi Returns NewMicrosoftTeamsIntegrationApi. +func NewMicrosoftTeamsIntegrationApi(client *datadog.APIClient) *MicrosoftTeamsIntegrationApi { + return &MicrosoftTeamsIntegrationApi{ + Client: client, + } +} diff --git a/api/datadogV2/doc.go b/api/datadogV2/doc.go index 1f7f7ae4ced..bac7fb034ce 100644 --- a/api/datadogV2/doc.go +++ b/api/datadogV2/doc.go @@ -197,6 +197,13 @@ // - [MetricsApi.QueryTimeseriesData] // - [MetricsApi.SubmitMetrics] // - [MetricsApi.UpdateTagConfiguration] +// - [MicrosoftTeamsIntegrationApi.CreateApiHandle] +// - [MicrosoftTeamsIntegrationApi.DeleteApiHandle] +// - [MicrosoftTeamsIntegrationApi.GetApiHandle] +// - [MicrosoftTeamsIntegrationApi.GetApiHandleByName] +// - [MicrosoftTeamsIntegrationApi.GetChannelByName] +// - [MicrosoftTeamsIntegrationApi.ListApiHandles] +// - [MicrosoftTeamsIntegrationApi.UpdateApiHandle] // - [MonitorsApi.CreateMonitorConfigPolicy] // - [MonitorsApi.DeleteMonitorConfigPolicy] // - [MonitorsApi.GetMonitorConfigPolicy] diff --git a/api/datadogV2/model_microsoft_teams_api_handle_attributes.go b/api/datadogV2/model_microsoft_teams_api_handle_attributes.go new file mode 100644 index 00000000000..daadeeac25e --- /dev/null +++ b/api/datadogV2/model_microsoft_teams_api_handle_attributes.go @@ -0,0 +1,207 @@ +// 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" +) + +// MicrosoftTeamsApiHandleAttributes Handle attributes. +type MicrosoftTeamsApiHandleAttributes struct { + // Channel id. + ChannelId *string `json:"channel_id,omitempty"` + // Handle name. + Name *string `json:"name,omitempty"` + // Team id. + TeamId *string `json:"team_id,omitempty"` + // Tenant id. + TenantId *string `json:"tenant_id,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{} `json:"-"` +} + +// NewMicrosoftTeamsApiHandleAttributes instantiates a new MicrosoftTeamsApiHandleAttributes 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 NewMicrosoftTeamsApiHandleAttributes() *MicrosoftTeamsApiHandleAttributes { + this := MicrosoftTeamsApiHandleAttributes{} + return &this +} + +// NewMicrosoftTeamsApiHandleAttributesWithDefaults instantiates a new MicrosoftTeamsApiHandleAttributes 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 NewMicrosoftTeamsApiHandleAttributesWithDefaults() *MicrosoftTeamsApiHandleAttributes { + this := MicrosoftTeamsApiHandleAttributes{} + return &this +} + +// GetChannelId returns the ChannelId field value if set, zero value otherwise. +func (o *MicrosoftTeamsApiHandleAttributes) GetChannelId() string { + if o == nil || o.ChannelId == nil { + var ret string + return ret + } + return *o.ChannelId +} + +// GetChannelIdOk returns a tuple with the ChannelId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MicrosoftTeamsApiHandleAttributes) GetChannelIdOk() (*string, bool) { + if o == nil || o.ChannelId == nil { + return nil, false + } + return o.ChannelId, true +} + +// HasChannelId returns a boolean if a field has been set. +func (o *MicrosoftTeamsApiHandleAttributes) HasChannelId() bool { + return o != nil && o.ChannelId != nil +} + +// SetChannelId gets a reference to the given string and assigns it to the ChannelId field. +func (o *MicrosoftTeamsApiHandleAttributes) SetChannelId(v string) { + o.ChannelId = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *MicrosoftTeamsApiHandleAttributes) GetName() string { + if o == nil || o.Name == nil { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MicrosoftTeamsApiHandleAttributes) GetNameOk() (*string, bool) { + if o == nil || o.Name == nil { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *MicrosoftTeamsApiHandleAttributes) HasName() bool { + return o != nil && o.Name != nil +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *MicrosoftTeamsApiHandleAttributes) SetName(v string) { + o.Name = &v +} + +// GetTeamId returns the TeamId field value if set, zero value otherwise. +func (o *MicrosoftTeamsApiHandleAttributes) GetTeamId() string { + if o == nil || o.TeamId == nil { + var ret string + return ret + } + return *o.TeamId +} + +// GetTeamIdOk returns a tuple with the TeamId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MicrosoftTeamsApiHandleAttributes) GetTeamIdOk() (*string, bool) { + if o == nil || o.TeamId == nil { + return nil, false + } + return o.TeamId, true +} + +// HasTeamId returns a boolean if a field has been set. +func (o *MicrosoftTeamsApiHandleAttributes) HasTeamId() bool { + return o != nil && o.TeamId != nil +} + +// SetTeamId gets a reference to the given string and assigns it to the TeamId field. +func (o *MicrosoftTeamsApiHandleAttributes) SetTeamId(v string) { + o.TeamId = &v +} + +// GetTenantId returns the TenantId field value if set, zero value otherwise. +func (o *MicrosoftTeamsApiHandleAttributes) GetTenantId() string { + if o == nil || o.TenantId == nil { + var ret string + return ret + } + return *o.TenantId +} + +// GetTenantIdOk returns a tuple with the TenantId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MicrosoftTeamsApiHandleAttributes) GetTenantIdOk() (*string, bool) { + if o == nil || o.TenantId == nil { + return nil, false + } + return o.TenantId, true +} + +// HasTenantId returns a boolean if a field has been set. +func (o *MicrosoftTeamsApiHandleAttributes) HasTenantId() bool { + return o != nil && o.TenantId != nil +} + +// SetTenantId gets a reference to the given string and assigns it to the TenantId field. +func (o *MicrosoftTeamsApiHandleAttributes) SetTenantId(v string) { + o.TenantId = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o MicrosoftTeamsApiHandleAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.ChannelId != nil { + toSerialize["channel_id"] = o.ChannelId + } + if o.Name != nil { + toSerialize["name"] = o.Name + } + if o.TeamId != nil { + toSerialize["team_id"] = o.TeamId + } + if o.TenantId != nil { + toSerialize["tenant_id"] = o.TenantId + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *MicrosoftTeamsApiHandleAttributes) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + ChannelId *string `json:"channel_id,omitempty"` + Name *string `json:"name,omitempty"` + TeamId *string `json:"team_id,omitempty"` + TenantId *string `json:"tenant_id,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{"channel_id", "name", "team_id", "tenant_id"}) + } else { + return err + } + o.ChannelId = all.ChannelId + o.Name = all.Name + o.TeamId = all.TeamId + o.TenantId = all.TenantId + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_microsoft_teams_api_handle_info_response.go b/api/datadogV2/model_microsoft_teams_api_handle_info_response.go new file mode 100644 index 00000000000..9a6075aef9a --- /dev/null +++ b/api/datadogV2/model_microsoft_teams_api_handle_info_response.go @@ -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" +) + +// MicrosoftTeamsApiHandleInfoResponse Response of a handle. +type MicrosoftTeamsApiHandleInfoResponse struct { + // Handle data from a response. + Data *MicrosoftTeamsApiHandleInfoResponseData `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{} `json:"-"` +} + +// NewMicrosoftTeamsApiHandleInfoResponse instantiates a new MicrosoftTeamsApiHandleInfoResponse 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 NewMicrosoftTeamsApiHandleInfoResponse() *MicrosoftTeamsApiHandleInfoResponse { + this := MicrosoftTeamsApiHandleInfoResponse{} + return &this +} + +// NewMicrosoftTeamsApiHandleInfoResponseWithDefaults instantiates a new MicrosoftTeamsApiHandleInfoResponse 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 NewMicrosoftTeamsApiHandleInfoResponseWithDefaults() *MicrosoftTeamsApiHandleInfoResponse { + this := MicrosoftTeamsApiHandleInfoResponse{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *MicrosoftTeamsApiHandleInfoResponse) GetData() MicrosoftTeamsApiHandleInfoResponseData { + if o == nil || o.Data == nil { + var ret MicrosoftTeamsApiHandleInfoResponseData + 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 *MicrosoftTeamsApiHandleInfoResponse) GetDataOk() (*MicrosoftTeamsApiHandleInfoResponseData, 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 *MicrosoftTeamsApiHandleInfoResponse) HasData() bool { + return o != nil && o.Data != nil +} + +// SetData gets a reference to the given MicrosoftTeamsApiHandleInfoResponseData and assigns it to the Data field. +func (o *MicrosoftTeamsApiHandleInfoResponse) SetData(v MicrosoftTeamsApiHandleInfoResponseData) { + o.Data = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o MicrosoftTeamsApiHandleInfoResponse) 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 *MicrosoftTeamsApiHandleInfoResponse) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *MicrosoftTeamsApiHandleInfoResponseData `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 +} diff --git a/api/datadogV2/model_microsoft_teams_api_handle_info_response_attributes.go b/api/datadogV2/model_microsoft_teams_api_handle_info_response_attributes.go new file mode 100644 index 00000000000..925771e07a7 --- /dev/null +++ b/api/datadogV2/model_microsoft_teams_api_handle_info_response_attributes.go @@ -0,0 +1,312 @@ +// 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" +) + +// MicrosoftTeamsApiHandleInfoResponseAttributes Handle attributes. +type MicrosoftTeamsApiHandleInfoResponseAttributes struct { + // Channel id. + ChannelId *string `json:"channel_id,omitempty"` + // Channel name. + ChannelName *string `json:"channel_name,omitempty"` + // Handle name. + Name *string `json:"name,omitempty"` + // Team id. + TeamId *string `json:"team_id,omitempty"` + // Team name. + TeamName *string `json:"team_name,omitempty"` + // Tenant id. + TenantId *string `json:"tenant_id,omitempty"` + // Tenant name. + TenantName *string `json:"tenant_name,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{} `json:"-"` +} + +// NewMicrosoftTeamsApiHandleInfoResponseAttributes instantiates a new MicrosoftTeamsApiHandleInfoResponseAttributes 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 NewMicrosoftTeamsApiHandleInfoResponseAttributes() *MicrosoftTeamsApiHandleInfoResponseAttributes { + this := MicrosoftTeamsApiHandleInfoResponseAttributes{} + return &this +} + +// NewMicrosoftTeamsApiHandleInfoResponseAttributesWithDefaults instantiates a new MicrosoftTeamsApiHandleInfoResponseAttributes 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 NewMicrosoftTeamsApiHandleInfoResponseAttributesWithDefaults() *MicrosoftTeamsApiHandleInfoResponseAttributes { + this := MicrosoftTeamsApiHandleInfoResponseAttributes{} + return &this +} + +// GetChannelId returns the ChannelId field value if set, zero value otherwise. +func (o *MicrosoftTeamsApiHandleInfoResponseAttributes) GetChannelId() string { + if o == nil || o.ChannelId == nil { + var ret string + return ret + } + return *o.ChannelId +} + +// GetChannelIdOk returns a tuple with the ChannelId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MicrosoftTeamsApiHandleInfoResponseAttributes) GetChannelIdOk() (*string, bool) { + if o == nil || o.ChannelId == nil { + return nil, false + } + return o.ChannelId, true +} + +// HasChannelId returns a boolean if a field has been set. +func (o *MicrosoftTeamsApiHandleInfoResponseAttributes) HasChannelId() bool { + return o != nil && o.ChannelId != nil +} + +// SetChannelId gets a reference to the given string and assigns it to the ChannelId field. +func (o *MicrosoftTeamsApiHandleInfoResponseAttributes) SetChannelId(v string) { + o.ChannelId = &v +} + +// GetChannelName returns the ChannelName field value if set, zero value otherwise. +func (o *MicrosoftTeamsApiHandleInfoResponseAttributes) GetChannelName() string { + if o == nil || o.ChannelName == nil { + var ret string + return ret + } + return *o.ChannelName +} + +// GetChannelNameOk returns a tuple with the ChannelName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MicrosoftTeamsApiHandleInfoResponseAttributes) GetChannelNameOk() (*string, bool) { + if o == nil || o.ChannelName == nil { + return nil, false + } + return o.ChannelName, true +} + +// HasChannelName returns a boolean if a field has been set. +func (o *MicrosoftTeamsApiHandleInfoResponseAttributes) HasChannelName() bool { + return o != nil && o.ChannelName != nil +} + +// SetChannelName gets a reference to the given string and assigns it to the ChannelName field. +func (o *MicrosoftTeamsApiHandleInfoResponseAttributes) SetChannelName(v string) { + o.ChannelName = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *MicrosoftTeamsApiHandleInfoResponseAttributes) GetName() string { + if o == nil || o.Name == nil { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MicrosoftTeamsApiHandleInfoResponseAttributes) GetNameOk() (*string, bool) { + if o == nil || o.Name == nil { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *MicrosoftTeamsApiHandleInfoResponseAttributes) HasName() bool { + return o != nil && o.Name != nil +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *MicrosoftTeamsApiHandleInfoResponseAttributes) SetName(v string) { + o.Name = &v +} + +// GetTeamId returns the TeamId field value if set, zero value otherwise. +func (o *MicrosoftTeamsApiHandleInfoResponseAttributes) GetTeamId() string { + if o == nil || o.TeamId == nil { + var ret string + return ret + } + return *o.TeamId +} + +// GetTeamIdOk returns a tuple with the TeamId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MicrosoftTeamsApiHandleInfoResponseAttributes) GetTeamIdOk() (*string, bool) { + if o == nil || o.TeamId == nil { + return nil, false + } + return o.TeamId, true +} + +// HasTeamId returns a boolean if a field has been set. +func (o *MicrosoftTeamsApiHandleInfoResponseAttributes) HasTeamId() bool { + return o != nil && o.TeamId != nil +} + +// SetTeamId gets a reference to the given string and assigns it to the TeamId field. +func (o *MicrosoftTeamsApiHandleInfoResponseAttributes) SetTeamId(v string) { + o.TeamId = &v +} + +// GetTeamName returns the TeamName field value if set, zero value otherwise. +func (o *MicrosoftTeamsApiHandleInfoResponseAttributes) GetTeamName() string { + if o == nil || o.TeamName == nil { + var ret string + return ret + } + return *o.TeamName +} + +// GetTeamNameOk returns a tuple with the TeamName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MicrosoftTeamsApiHandleInfoResponseAttributes) GetTeamNameOk() (*string, bool) { + if o == nil || o.TeamName == nil { + return nil, false + } + return o.TeamName, true +} + +// HasTeamName returns a boolean if a field has been set. +func (o *MicrosoftTeamsApiHandleInfoResponseAttributes) HasTeamName() bool { + return o != nil && o.TeamName != nil +} + +// SetTeamName gets a reference to the given string and assigns it to the TeamName field. +func (o *MicrosoftTeamsApiHandleInfoResponseAttributes) SetTeamName(v string) { + o.TeamName = &v +} + +// GetTenantId returns the TenantId field value if set, zero value otherwise. +func (o *MicrosoftTeamsApiHandleInfoResponseAttributes) GetTenantId() string { + if o == nil || o.TenantId == nil { + var ret string + return ret + } + return *o.TenantId +} + +// GetTenantIdOk returns a tuple with the TenantId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MicrosoftTeamsApiHandleInfoResponseAttributes) GetTenantIdOk() (*string, bool) { + if o == nil || o.TenantId == nil { + return nil, false + } + return o.TenantId, true +} + +// HasTenantId returns a boolean if a field has been set. +func (o *MicrosoftTeamsApiHandleInfoResponseAttributes) HasTenantId() bool { + return o != nil && o.TenantId != nil +} + +// SetTenantId gets a reference to the given string and assigns it to the TenantId field. +func (o *MicrosoftTeamsApiHandleInfoResponseAttributes) SetTenantId(v string) { + o.TenantId = &v +} + +// GetTenantName returns the TenantName field value if set, zero value otherwise. +func (o *MicrosoftTeamsApiHandleInfoResponseAttributes) GetTenantName() string { + if o == nil || o.TenantName == nil { + var ret string + return ret + } + return *o.TenantName +} + +// GetTenantNameOk returns a tuple with the TenantName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MicrosoftTeamsApiHandleInfoResponseAttributes) GetTenantNameOk() (*string, bool) { + if o == nil || o.TenantName == nil { + return nil, false + } + return o.TenantName, true +} + +// HasTenantName returns a boolean if a field has been set. +func (o *MicrosoftTeamsApiHandleInfoResponseAttributes) HasTenantName() bool { + return o != nil && o.TenantName != nil +} + +// SetTenantName gets a reference to the given string and assigns it to the TenantName field. +func (o *MicrosoftTeamsApiHandleInfoResponseAttributes) SetTenantName(v string) { + o.TenantName = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o MicrosoftTeamsApiHandleInfoResponseAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.ChannelId != nil { + toSerialize["channel_id"] = o.ChannelId + } + if o.ChannelName != nil { + toSerialize["channel_name"] = o.ChannelName + } + if o.Name != nil { + toSerialize["name"] = o.Name + } + if o.TeamId != nil { + toSerialize["team_id"] = o.TeamId + } + if o.TeamName != nil { + toSerialize["team_name"] = o.TeamName + } + if o.TenantId != nil { + toSerialize["tenant_id"] = o.TenantId + } + if o.TenantName != nil { + toSerialize["tenant_name"] = o.TenantName + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *MicrosoftTeamsApiHandleInfoResponseAttributes) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + ChannelId *string `json:"channel_id,omitempty"` + ChannelName *string `json:"channel_name,omitempty"` + Name *string `json:"name,omitempty"` + TeamId *string `json:"team_id,omitempty"` + TeamName *string `json:"team_name,omitempty"` + TenantId *string `json:"tenant_id,omitempty"` + TenantName *string `json:"tenant_name,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{"channel_id", "channel_name", "name", "team_id", "team_name", "tenant_id", "tenant_name"}) + } else { + return err + } + o.ChannelId = all.ChannelId + o.ChannelName = all.ChannelName + o.Name = all.Name + o.TeamId = all.TeamId + o.TeamName = all.TeamName + o.TenantId = all.TenantId + o.TenantName = all.TenantName + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_microsoft_teams_api_handle_info_response_data.go b/api/datadogV2/model_microsoft_teams_api_handle_info_response_data.go new file mode 100644 index 00000000000..40e033f3b9c --- /dev/null +++ b/api/datadogV2/model_microsoft_teams_api_handle_info_response_data.go @@ -0,0 +1,189 @@ +// 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" +) + +// MicrosoftTeamsApiHandleInfoResponseData Handle data from a response. +type MicrosoftTeamsApiHandleInfoResponseData struct { + // Handle attributes. + Attributes *MicrosoftTeamsApiHandleInfoResponseAttributes `json:"attributes,omitempty"` + // The ID of the handle. + Id *string `json:"id,omitempty"` + // Handle resource type. + Type *MicrosoftTeamsApiHandleInfoType `json:"type,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{} `json:"-"` +} + +// NewMicrosoftTeamsApiHandleInfoResponseData instantiates a new MicrosoftTeamsApiHandleInfoResponseData 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 NewMicrosoftTeamsApiHandleInfoResponseData() *MicrosoftTeamsApiHandleInfoResponseData { + this := MicrosoftTeamsApiHandleInfoResponseData{} + var typeVar MicrosoftTeamsApiHandleInfoType = MICROSOFTTEAMSAPIHANDLEINFOTYPE_MS_TEAMS_HANDLE_INFO + this.Type = &typeVar + return &this +} + +// NewMicrosoftTeamsApiHandleInfoResponseDataWithDefaults instantiates a new MicrosoftTeamsApiHandleInfoResponseData 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 NewMicrosoftTeamsApiHandleInfoResponseDataWithDefaults() *MicrosoftTeamsApiHandleInfoResponseData { + this := MicrosoftTeamsApiHandleInfoResponseData{} + var typeVar MicrosoftTeamsApiHandleInfoType = MICROSOFTTEAMSAPIHANDLEINFOTYPE_MS_TEAMS_HANDLE_INFO + this.Type = &typeVar + return &this +} + +// GetAttributes returns the Attributes field value if set, zero value otherwise. +func (o *MicrosoftTeamsApiHandleInfoResponseData) GetAttributes() MicrosoftTeamsApiHandleInfoResponseAttributes { + if o == nil || o.Attributes == nil { + var ret MicrosoftTeamsApiHandleInfoResponseAttributes + return ret + } + return *o.Attributes +} + +// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MicrosoftTeamsApiHandleInfoResponseData) GetAttributesOk() (*MicrosoftTeamsApiHandleInfoResponseAttributes, bool) { + if o == nil || o.Attributes == nil { + return nil, false + } + return o.Attributes, true +} + +// HasAttributes returns a boolean if a field has been set. +func (o *MicrosoftTeamsApiHandleInfoResponseData) HasAttributes() bool { + return o != nil && o.Attributes != nil +} + +// SetAttributes gets a reference to the given MicrosoftTeamsApiHandleInfoResponseAttributes and assigns it to the Attributes field. +func (o *MicrosoftTeamsApiHandleInfoResponseData) SetAttributes(v MicrosoftTeamsApiHandleInfoResponseAttributes) { + o.Attributes = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *MicrosoftTeamsApiHandleInfoResponseData) GetId() string { + if o == nil || o.Id == nil { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MicrosoftTeamsApiHandleInfoResponseData) GetIdOk() (*string, bool) { + if o == nil || o.Id == nil { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *MicrosoftTeamsApiHandleInfoResponseData) HasId() bool { + return o != nil && o.Id != nil +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *MicrosoftTeamsApiHandleInfoResponseData) SetId(v string) { + o.Id = &v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *MicrosoftTeamsApiHandleInfoResponseData) GetType() MicrosoftTeamsApiHandleInfoType { + if o == nil || o.Type == nil { + var ret MicrosoftTeamsApiHandleInfoType + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MicrosoftTeamsApiHandleInfoResponseData) GetTypeOk() (*MicrosoftTeamsApiHandleInfoType, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *MicrosoftTeamsApiHandleInfoResponseData) HasType() bool { + return o != nil && o.Type != nil +} + +// SetType gets a reference to the given MicrosoftTeamsApiHandleInfoType and assigns it to the Type field. +func (o *MicrosoftTeamsApiHandleInfoResponseData) SetType(v MicrosoftTeamsApiHandleInfoType) { + o.Type = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o MicrosoftTeamsApiHandleInfoResponseData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Attributes != nil { + toSerialize["attributes"] = o.Attributes + } + if o.Id != nil { + toSerialize["id"] = o.Id + } + if o.Type != nil { + toSerialize["type"] = o.Type + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *MicrosoftTeamsApiHandleInfoResponseData) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *MicrosoftTeamsApiHandleInfoResponseAttributes `json:"attributes,omitempty"` + Id *string `json:"id,omitempty"` + Type *MicrosoftTeamsApiHandleInfoType `json:"type,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{"attributes", "id", "type"}) + } else { + return err + } + + hasInvalidField := false + if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Attributes = all.Attributes + o.Id = all.Id + if all.Type != nil && !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = all.Type + } + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_microsoft_teams_api_handle_info_type.go b/api/datadogV2/model_microsoft_teams_api_handle_info_type.go new file mode 100644 index 00000000000..3e112052f94 --- /dev/null +++ b/api/datadogV2/model_microsoft_teams_api_handle_info_type.go @@ -0,0 +1,64 @@ +// 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 ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// MicrosoftTeamsApiHandleInfoType Handle resource type. +type MicrosoftTeamsApiHandleInfoType string + +// List of MicrosoftTeamsApiHandleInfoType. +const ( + MICROSOFTTEAMSAPIHANDLEINFOTYPE_MS_TEAMS_HANDLE_INFO MicrosoftTeamsApiHandleInfoType = "ms-teams-handle-info" +) + +var allowedMicrosoftTeamsApiHandleInfoTypeEnumValues = []MicrosoftTeamsApiHandleInfoType{ + MICROSOFTTEAMSAPIHANDLEINFOTYPE_MS_TEAMS_HANDLE_INFO, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *MicrosoftTeamsApiHandleInfoType) GetAllowedValues() []MicrosoftTeamsApiHandleInfoType { + return allowedMicrosoftTeamsApiHandleInfoTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *MicrosoftTeamsApiHandleInfoType) UnmarshalJSON(src []byte) error { + var value string + err := datadog.Unmarshal(src, &value) + if err != nil { + return err + } + *v = MicrosoftTeamsApiHandleInfoType(value) + return nil +} + +// NewMicrosoftTeamsApiHandleInfoTypeFromValue returns a pointer to a valid MicrosoftTeamsApiHandleInfoType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewMicrosoftTeamsApiHandleInfoTypeFromValue(v string) (*MicrosoftTeamsApiHandleInfoType, error) { + ev := MicrosoftTeamsApiHandleInfoType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for MicrosoftTeamsApiHandleInfoType: valid values are %v", v, allowedMicrosoftTeamsApiHandleInfoTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v MicrosoftTeamsApiHandleInfoType) IsValid() bool { + for _, existing := range allowedMicrosoftTeamsApiHandleInfoTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to MicrosoftTeamsApiHandleInfoType value. +func (v MicrosoftTeamsApiHandleInfoType) Ptr() *MicrosoftTeamsApiHandleInfoType { + return &v +} diff --git a/api/datadogV2/model_microsoft_teams_api_handle_request_attributes.go b/api/datadogV2/model_microsoft_teams_api_handle_request_attributes.go new file mode 100644 index 00000000000..8b6d6fec79a --- /dev/null +++ b/api/datadogV2/model_microsoft_teams_api_handle_request_attributes.go @@ -0,0 +1,197 @@ +// 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 ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// MicrosoftTeamsApiHandleRequestAttributes Handle attributes. +type MicrosoftTeamsApiHandleRequestAttributes struct { + // Channel id. + ChannelId string `json:"channel_id"` + // Handle name. + Name string `json:"name"` + // Team id. + TeamId string `json:"team_id"` + // Tenant id. + TenantId string `json:"tenant_id"` + // 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{} `json:"-"` +} + +// NewMicrosoftTeamsApiHandleRequestAttributes instantiates a new MicrosoftTeamsApiHandleRequestAttributes 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 NewMicrosoftTeamsApiHandleRequestAttributes(channelId string, name string, teamId string, tenantId string) *MicrosoftTeamsApiHandleRequestAttributes { + this := MicrosoftTeamsApiHandleRequestAttributes{} + this.ChannelId = channelId + this.Name = name + this.TeamId = teamId + this.TenantId = tenantId + return &this +} + +// NewMicrosoftTeamsApiHandleRequestAttributesWithDefaults instantiates a new MicrosoftTeamsApiHandleRequestAttributes 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 NewMicrosoftTeamsApiHandleRequestAttributesWithDefaults() *MicrosoftTeamsApiHandleRequestAttributes { + this := MicrosoftTeamsApiHandleRequestAttributes{} + return &this +} + +// GetChannelId returns the ChannelId field value. +func (o *MicrosoftTeamsApiHandleRequestAttributes) GetChannelId() string { + if o == nil { + var ret string + return ret + } + return o.ChannelId +} + +// GetChannelIdOk returns a tuple with the ChannelId field value +// and a boolean to check if the value has been set. +func (o *MicrosoftTeamsApiHandleRequestAttributes) GetChannelIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.ChannelId, true +} + +// SetChannelId sets field value. +func (o *MicrosoftTeamsApiHandleRequestAttributes) SetChannelId(v string) { + o.ChannelId = v +} + +// GetName returns the Name field value. +func (o *MicrosoftTeamsApiHandleRequestAttributes) GetName() string { + if o == nil { + var ret string + return ret + } + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *MicrosoftTeamsApiHandleRequestAttributes) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value. +func (o *MicrosoftTeamsApiHandleRequestAttributes) SetName(v string) { + o.Name = v +} + +// GetTeamId returns the TeamId field value. +func (o *MicrosoftTeamsApiHandleRequestAttributes) GetTeamId() string { + if o == nil { + var ret string + return ret + } + return o.TeamId +} + +// GetTeamIdOk returns a tuple with the TeamId field value +// and a boolean to check if the value has been set. +func (o *MicrosoftTeamsApiHandleRequestAttributes) GetTeamIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.TeamId, true +} + +// SetTeamId sets field value. +func (o *MicrosoftTeamsApiHandleRequestAttributes) SetTeamId(v string) { + o.TeamId = v +} + +// GetTenantId returns the TenantId field value. +func (o *MicrosoftTeamsApiHandleRequestAttributes) GetTenantId() string { + if o == nil { + var ret string + return ret + } + return o.TenantId +} + +// GetTenantIdOk returns a tuple with the TenantId field value +// and a boolean to check if the value has been set. +func (o *MicrosoftTeamsApiHandleRequestAttributes) GetTenantIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.TenantId, true +} + +// SetTenantId sets field value. +func (o *MicrosoftTeamsApiHandleRequestAttributes) SetTenantId(v string) { + o.TenantId = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o MicrosoftTeamsApiHandleRequestAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["channel_id"] = o.ChannelId + toSerialize["name"] = o.Name + toSerialize["team_id"] = o.TeamId + toSerialize["tenant_id"] = o.TenantId + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *MicrosoftTeamsApiHandleRequestAttributes) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + ChannelId *string `json:"channel_id"` + Name *string `json:"name"` + TeamId *string `json:"team_id"` + TenantId *string `json:"tenant_id"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.ChannelId == nil { + return fmt.Errorf("required field channel_id missing") + } + if all.Name == nil { + return fmt.Errorf("required field name missing") + } + if all.TeamId == nil { + return fmt.Errorf("required field team_id missing") + } + if all.TenantId == nil { + return fmt.Errorf("required field tenant_id missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"channel_id", "name", "team_id", "tenant_id"}) + } else { + return err + } + o.ChannelId = *all.ChannelId + o.Name = *all.Name + o.TeamId = *all.TeamId + o.TenantId = *all.TenantId + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_microsoft_teams_api_handle_request_data.go b/api/datadogV2/model_microsoft_teams_api_handle_request_data.go new file mode 100644 index 00000000000..c9a592991db --- /dev/null +++ b/api/datadogV2/model_microsoft_teams_api_handle_request_data.go @@ -0,0 +1,148 @@ +// 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 ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// MicrosoftTeamsApiHandleRequestData Handle data from a response. +type MicrosoftTeamsApiHandleRequestData struct { + // Handle attributes. + Attributes MicrosoftTeamsApiHandleRequestAttributes `json:"attributes"` + // Specifies the handle resource type. + Type MicrosoftTeamsApiHandleType `json:"type"` + // 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{} `json:"-"` +} + +// NewMicrosoftTeamsApiHandleRequestData instantiates a new MicrosoftTeamsApiHandleRequestData 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 NewMicrosoftTeamsApiHandleRequestData(attributes MicrosoftTeamsApiHandleRequestAttributes, typeVar MicrosoftTeamsApiHandleType) *MicrosoftTeamsApiHandleRequestData { + this := MicrosoftTeamsApiHandleRequestData{} + this.Attributes = attributes + this.Type = typeVar + return &this +} + +// NewMicrosoftTeamsApiHandleRequestDataWithDefaults instantiates a new MicrosoftTeamsApiHandleRequestData 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 NewMicrosoftTeamsApiHandleRequestDataWithDefaults() *MicrosoftTeamsApiHandleRequestData { + this := MicrosoftTeamsApiHandleRequestData{} + var typeVar MicrosoftTeamsApiHandleType = MICROSOFTTEAMSAPIHANDLETYPE_HANDLE + this.Type = typeVar + return &this +} + +// GetAttributes returns the Attributes field value. +func (o *MicrosoftTeamsApiHandleRequestData) GetAttributes() MicrosoftTeamsApiHandleRequestAttributes { + if o == nil { + var ret MicrosoftTeamsApiHandleRequestAttributes + return ret + } + return o.Attributes +} + +// GetAttributesOk returns a tuple with the Attributes field value +// and a boolean to check if the value has been set. +func (o *MicrosoftTeamsApiHandleRequestData) GetAttributesOk() (*MicrosoftTeamsApiHandleRequestAttributes, bool) { + if o == nil { + return nil, false + } + return &o.Attributes, true +} + +// SetAttributes sets field value. +func (o *MicrosoftTeamsApiHandleRequestData) SetAttributes(v MicrosoftTeamsApiHandleRequestAttributes) { + o.Attributes = v +} + +// GetType returns the Type field value. +func (o *MicrosoftTeamsApiHandleRequestData) GetType() MicrosoftTeamsApiHandleType { + if o == nil { + var ret MicrosoftTeamsApiHandleType + return ret + } + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *MicrosoftTeamsApiHandleRequestData) GetTypeOk() (*MicrosoftTeamsApiHandleType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *MicrosoftTeamsApiHandleRequestData) SetType(v MicrosoftTeamsApiHandleType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o MicrosoftTeamsApiHandleRequestData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["attributes"] = o.Attributes + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *MicrosoftTeamsApiHandleRequestData) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *MicrosoftTeamsApiHandleRequestAttributes `json:"attributes"` + Type *MicrosoftTeamsApiHandleType `json:"type"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Attributes == nil { + return fmt.Errorf("required field attributes missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "type"}) + } else { + return err + } + + hasInvalidField := false + if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Attributes = *all.Attributes + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_microsoft_teams_api_handle_response_data.go b/api/datadogV2/model_microsoft_teams_api_handle_response_data.go new file mode 100644 index 00000000000..9a5d6b19548 --- /dev/null +++ b/api/datadogV2/model_microsoft_teams_api_handle_response_data.go @@ -0,0 +1,189 @@ +// 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" +) + +// MicrosoftTeamsApiHandleResponseData Handle data from a response. +type MicrosoftTeamsApiHandleResponseData struct { + // Handle attributes. + Attributes *MicrosoftTeamsApiHandleAttributes `json:"attributes,omitempty"` + // The ID of the handle. + Id *string `json:"id,omitempty"` + // Specifies the handle resource type. + Type *MicrosoftTeamsApiHandleType `json:"type,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{} `json:"-"` +} + +// NewMicrosoftTeamsApiHandleResponseData instantiates a new MicrosoftTeamsApiHandleResponseData 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 NewMicrosoftTeamsApiHandleResponseData() *MicrosoftTeamsApiHandleResponseData { + this := MicrosoftTeamsApiHandleResponseData{} + var typeVar MicrosoftTeamsApiHandleType = MICROSOFTTEAMSAPIHANDLETYPE_HANDLE + this.Type = &typeVar + return &this +} + +// NewMicrosoftTeamsApiHandleResponseDataWithDefaults instantiates a new MicrosoftTeamsApiHandleResponseData 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 NewMicrosoftTeamsApiHandleResponseDataWithDefaults() *MicrosoftTeamsApiHandleResponseData { + this := MicrosoftTeamsApiHandleResponseData{} + var typeVar MicrosoftTeamsApiHandleType = MICROSOFTTEAMSAPIHANDLETYPE_HANDLE + this.Type = &typeVar + return &this +} + +// GetAttributes returns the Attributes field value if set, zero value otherwise. +func (o *MicrosoftTeamsApiHandleResponseData) GetAttributes() MicrosoftTeamsApiHandleAttributes { + if o == nil || o.Attributes == nil { + var ret MicrosoftTeamsApiHandleAttributes + return ret + } + return *o.Attributes +} + +// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MicrosoftTeamsApiHandleResponseData) GetAttributesOk() (*MicrosoftTeamsApiHandleAttributes, bool) { + if o == nil || o.Attributes == nil { + return nil, false + } + return o.Attributes, true +} + +// HasAttributes returns a boolean if a field has been set. +func (o *MicrosoftTeamsApiHandleResponseData) HasAttributes() bool { + return o != nil && o.Attributes != nil +} + +// SetAttributes gets a reference to the given MicrosoftTeamsApiHandleAttributes and assigns it to the Attributes field. +func (o *MicrosoftTeamsApiHandleResponseData) SetAttributes(v MicrosoftTeamsApiHandleAttributes) { + o.Attributes = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *MicrosoftTeamsApiHandleResponseData) GetId() string { + if o == nil || o.Id == nil { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MicrosoftTeamsApiHandleResponseData) GetIdOk() (*string, bool) { + if o == nil || o.Id == nil { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *MicrosoftTeamsApiHandleResponseData) HasId() bool { + return o != nil && o.Id != nil +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *MicrosoftTeamsApiHandleResponseData) SetId(v string) { + o.Id = &v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *MicrosoftTeamsApiHandleResponseData) GetType() MicrosoftTeamsApiHandleType { + if o == nil || o.Type == nil { + var ret MicrosoftTeamsApiHandleType + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MicrosoftTeamsApiHandleResponseData) GetTypeOk() (*MicrosoftTeamsApiHandleType, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *MicrosoftTeamsApiHandleResponseData) HasType() bool { + return o != nil && o.Type != nil +} + +// SetType gets a reference to the given MicrosoftTeamsApiHandleType and assigns it to the Type field. +func (o *MicrosoftTeamsApiHandleResponseData) SetType(v MicrosoftTeamsApiHandleType) { + o.Type = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o MicrosoftTeamsApiHandleResponseData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Attributes != nil { + toSerialize["attributes"] = o.Attributes + } + if o.Id != nil { + toSerialize["id"] = o.Id + } + if o.Type != nil { + toSerialize["type"] = o.Type + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *MicrosoftTeamsApiHandleResponseData) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *MicrosoftTeamsApiHandleAttributes `json:"attributes,omitempty"` + Id *string `json:"id,omitempty"` + Type *MicrosoftTeamsApiHandleType `json:"type,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{"attributes", "id", "type"}) + } else { + return err + } + + hasInvalidField := false + if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Attributes = all.Attributes + o.Id = all.Id + if all.Type != nil && !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = all.Type + } + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_microsoft_teams_api_handle_type.go b/api/datadogV2/model_microsoft_teams_api_handle_type.go new file mode 100644 index 00000000000..12fb4ea357c --- /dev/null +++ b/api/datadogV2/model_microsoft_teams_api_handle_type.go @@ -0,0 +1,64 @@ +// 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 ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// MicrosoftTeamsApiHandleType Specifies the handle resource type. +type MicrosoftTeamsApiHandleType string + +// List of MicrosoftTeamsApiHandleType. +const ( + MICROSOFTTEAMSAPIHANDLETYPE_HANDLE MicrosoftTeamsApiHandleType = "handle" +) + +var allowedMicrosoftTeamsApiHandleTypeEnumValues = []MicrosoftTeamsApiHandleType{ + MICROSOFTTEAMSAPIHANDLETYPE_HANDLE, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *MicrosoftTeamsApiHandleType) GetAllowedValues() []MicrosoftTeamsApiHandleType { + return allowedMicrosoftTeamsApiHandleTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *MicrosoftTeamsApiHandleType) UnmarshalJSON(src []byte) error { + var value string + err := datadog.Unmarshal(src, &value) + if err != nil { + return err + } + *v = MicrosoftTeamsApiHandleType(value) + return nil +} + +// NewMicrosoftTeamsApiHandleTypeFromValue returns a pointer to a valid MicrosoftTeamsApiHandleType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewMicrosoftTeamsApiHandleTypeFromValue(v string) (*MicrosoftTeamsApiHandleType, error) { + ev := MicrosoftTeamsApiHandleType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for MicrosoftTeamsApiHandleType: valid values are %v", v, allowedMicrosoftTeamsApiHandleTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v MicrosoftTeamsApiHandleType) IsValid() bool { + for _, existing := range allowedMicrosoftTeamsApiHandleTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to MicrosoftTeamsApiHandleType value. +func (v MicrosoftTeamsApiHandleType) Ptr() *MicrosoftTeamsApiHandleType { + return &v +} diff --git a/api/datadogV2/model_microsoft_teams_api_handles_response.go b/api/datadogV2/model_microsoft_teams_api_handles_response.go new file mode 100644 index 00000000000..df5a0d9ee5f --- /dev/null +++ b/api/datadogV2/model_microsoft_teams_api_handles_response.go @@ -0,0 +1,101 @@ +// 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 ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// MicrosoftTeamsApiHandlesResponse Response with a list of handles. +type MicrosoftTeamsApiHandlesResponse struct { + // An array of handles. + Data []MicrosoftTeamsApiHandleInfoResponseData `json:"data"` + // 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{} `json:"-"` +} + +// NewMicrosoftTeamsApiHandlesResponse instantiates a new MicrosoftTeamsApiHandlesResponse 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 NewMicrosoftTeamsApiHandlesResponse(data []MicrosoftTeamsApiHandleInfoResponseData) *MicrosoftTeamsApiHandlesResponse { + this := MicrosoftTeamsApiHandlesResponse{} + this.Data = data + return &this +} + +// NewMicrosoftTeamsApiHandlesResponseWithDefaults instantiates a new MicrosoftTeamsApiHandlesResponse 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 NewMicrosoftTeamsApiHandlesResponseWithDefaults() *MicrosoftTeamsApiHandlesResponse { + this := MicrosoftTeamsApiHandlesResponse{} + return &this +} + +// GetData returns the Data field value. +func (o *MicrosoftTeamsApiHandlesResponse) GetData() []MicrosoftTeamsApiHandleInfoResponseData { + if o == nil { + var ret []MicrosoftTeamsApiHandleInfoResponseData + return ret + } + return o.Data +} + +// GetDataOk returns a tuple with the Data field value +// and a boolean to check if the value has been set. +func (o *MicrosoftTeamsApiHandlesResponse) GetDataOk() (*[]MicrosoftTeamsApiHandleInfoResponseData, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *MicrosoftTeamsApiHandlesResponse) SetData(v []MicrosoftTeamsApiHandleInfoResponseData) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o MicrosoftTeamsApiHandlesResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["data"] = o.Data + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *MicrosoftTeamsApiHandlesResponse) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *[]MicrosoftTeamsApiHandleInfoResponseData `json:"data"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"data"}) + } else { + return err + } + o.Data = *all.Data + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_microsoft_teams_channel_info_response_attributes.go b/api/datadogV2/model_microsoft_teams_channel_info_response_attributes.go new file mode 100644 index 00000000000..54ff51ab035 --- /dev/null +++ b/api/datadogV2/model_microsoft_teams_channel_info_response_attributes.go @@ -0,0 +1,172 @@ +// 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" +) + +// MicrosoftTeamsChannelInfoResponseAttributes Channel attributes. +type MicrosoftTeamsChannelInfoResponseAttributes struct { + // Indicates if this is the primary channel. + IsPrimary *bool `json:"is_primary,omitempty"` + // Team id. + TeamId *string `json:"team_id,omitempty"` + // Tenant id. + TenantId *string `json:"tenant_id,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{} `json:"-"` +} + +// NewMicrosoftTeamsChannelInfoResponseAttributes instantiates a new MicrosoftTeamsChannelInfoResponseAttributes 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 NewMicrosoftTeamsChannelInfoResponseAttributes() *MicrosoftTeamsChannelInfoResponseAttributes { + this := MicrosoftTeamsChannelInfoResponseAttributes{} + return &this +} + +// NewMicrosoftTeamsChannelInfoResponseAttributesWithDefaults instantiates a new MicrosoftTeamsChannelInfoResponseAttributes 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 NewMicrosoftTeamsChannelInfoResponseAttributesWithDefaults() *MicrosoftTeamsChannelInfoResponseAttributes { + this := MicrosoftTeamsChannelInfoResponseAttributes{} + return &this +} + +// GetIsPrimary returns the IsPrimary field value if set, zero value otherwise. +func (o *MicrosoftTeamsChannelInfoResponseAttributes) GetIsPrimary() bool { + if o == nil || o.IsPrimary == nil { + var ret bool + return ret + } + return *o.IsPrimary +} + +// GetIsPrimaryOk returns a tuple with the IsPrimary field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MicrosoftTeamsChannelInfoResponseAttributes) GetIsPrimaryOk() (*bool, bool) { + if o == nil || o.IsPrimary == nil { + return nil, false + } + return o.IsPrimary, true +} + +// HasIsPrimary returns a boolean if a field has been set. +func (o *MicrosoftTeamsChannelInfoResponseAttributes) HasIsPrimary() bool { + return o != nil && o.IsPrimary != nil +} + +// SetIsPrimary gets a reference to the given bool and assigns it to the IsPrimary field. +func (o *MicrosoftTeamsChannelInfoResponseAttributes) SetIsPrimary(v bool) { + o.IsPrimary = &v +} + +// GetTeamId returns the TeamId field value if set, zero value otherwise. +func (o *MicrosoftTeamsChannelInfoResponseAttributes) GetTeamId() string { + if o == nil || o.TeamId == nil { + var ret string + return ret + } + return *o.TeamId +} + +// GetTeamIdOk returns a tuple with the TeamId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MicrosoftTeamsChannelInfoResponseAttributes) GetTeamIdOk() (*string, bool) { + if o == nil || o.TeamId == nil { + return nil, false + } + return o.TeamId, true +} + +// HasTeamId returns a boolean if a field has been set. +func (o *MicrosoftTeamsChannelInfoResponseAttributes) HasTeamId() bool { + return o != nil && o.TeamId != nil +} + +// SetTeamId gets a reference to the given string and assigns it to the TeamId field. +func (o *MicrosoftTeamsChannelInfoResponseAttributes) SetTeamId(v string) { + o.TeamId = &v +} + +// GetTenantId returns the TenantId field value if set, zero value otherwise. +func (o *MicrosoftTeamsChannelInfoResponseAttributes) GetTenantId() string { + if o == nil || o.TenantId == nil { + var ret string + return ret + } + return *o.TenantId +} + +// GetTenantIdOk returns a tuple with the TenantId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MicrosoftTeamsChannelInfoResponseAttributes) GetTenantIdOk() (*string, bool) { + if o == nil || o.TenantId == nil { + return nil, false + } + return o.TenantId, true +} + +// HasTenantId returns a boolean if a field has been set. +func (o *MicrosoftTeamsChannelInfoResponseAttributes) HasTenantId() bool { + return o != nil && o.TenantId != nil +} + +// SetTenantId gets a reference to the given string and assigns it to the TenantId field. +func (o *MicrosoftTeamsChannelInfoResponseAttributes) SetTenantId(v string) { + o.TenantId = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o MicrosoftTeamsChannelInfoResponseAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.IsPrimary != nil { + toSerialize["is_primary"] = o.IsPrimary + } + if o.TeamId != nil { + toSerialize["team_id"] = o.TeamId + } + if o.TenantId != nil { + toSerialize["tenant_id"] = o.TenantId + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *MicrosoftTeamsChannelInfoResponseAttributes) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + IsPrimary *bool `json:"is_primary,omitempty"` + TeamId *string `json:"team_id,omitempty"` + TenantId *string `json:"tenant_id,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{"is_primary", "team_id", "tenant_id"}) + } else { + return err + } + o.IsPrimary = all.IsPrimary + o.TeamId = all.TeamId + o.TenantId = all.TenantId + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_microsoft_teams_channel_info_response_data.go b/api/datadogV2/model_microsoft_teams_channel_info_response_data.go new file mode 100644 index 00000000000..4ec6122bebb --- /dev/null +++ b/api/datadogV2/model_microsoft_teams_channel_info_response_data.go @@ -0,0 +1,189 @@ +// 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" +) + +// MicrosoftTeamsChannelInfoResponseData Channel data from a response. +type MicrosoftTeamsChannelInfoResponseData struct { + // Channel attributes. + Attributes *MicrosoftTeamsChannelInfoResponseAttributes `json:"attributes,omitempty"` + // The ID of the channel. + Id *string `json:"id,omitempty"` + // Channel info resource type. + Type *MicrosoftTeamsChannelInfoType `json:"type,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{} `json:"-"` +} + +// NewMicrosoftTeamsChannelInfoResponseData instantiates a new MicrosoftTeamsChannelInfoResponseData 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 NewMicrosoftTeamsChannelInfoResponseData() *MicrosoftTeamsChannelInfoResponseData { + this := MicrosoftTeamsChannelInfoResponseData{} + var typeVar MicrosoftTeamsChannelInfoType = MICROSOFTTEAMSCHANNELINFOTYPE_MS_TEAMS_CHANNEL_INFO + this.Type = &typeVar + return &this +} + +// NewMicrosoftTeamsChannelInfoResponseDataWithDefaults instantiates a new MicrosoftTeamsChannelInfoResponseData 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 NewMicrosoftTeamsChannelInfoResponseDataWithDefaults() *MicrosoftTeamsChannelInfoResponseData { + this := MicrosoftTeamsChannelInfoResponseData{} + var typeVar MicrosoftTeamsChannelInfoType = MICROSOFTTEAMSCHANNELINFOTYPE_MS_TEAMS_CHANNEL_INFO + this.Type = &typeVar + return &this +} + +// GetAttributes returns the Attributes field value if set, zero value otherwise. +func (o *MicrosoftTeamsChannelInfoResponseData) GetAttributes() MicrosoftTeamsChannelInfoResponseAttributes { + if o == nil || o.Attributes == nil { + var ret MicrosoftTeamsChannelInfoResponseAttributes + return ret + } + return *o.Attributes +} + +// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MicrosoftTeamsChannelInfoResponseData) GetAttributesOk() (*MicrosoftTeamsChannelInfoResponseAttributes, bool) { + if o == nil || o.Attributes == nil { + return nil, false + } + return o.Attributes, true +} + +// HasAttributes returns a boolean if a field has been set. +func (o *MicrosoftTeamsChannelInfoResponseData) HasAttributes() bool { + return o != nil && o.Attributes != nil +} + +// SetAttributes gets a reference to the given MicrosoftTeamsChannelInfoResponseAttributes and assigns it to the Attributes field. +func (o *MicrosoftTeamsChannelInfoResponseData) SetAttributes(v MicrosoftTeamsChannelInfoResponseAttributes) { + o.Attributes = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *MicrosoftTeamsChannelInfoResponseData) GetId() string { + if o == nil || o.Id == nil { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MicrosoftTeamsChannelInfoResponseData) GetIdOk() (*string, bool) { + if o == nil || o.Id == nil { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *MicrosoftTeamsChannelInfoResponseData) HasId() bool { + return o != nil && o.Id != nil +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *MicrosoftTeamsChannelInfoResponseData) SetId(v string) { + o.Id = &v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *MicrosoftTeamsChannelInfoResponseData) GetType() MicrosoftTeamsChannelInfoType { + if o == nil || o.Type == nil { + var ret MicrosoftTeamsChannelInfoType + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MicrosoftTeamsChannelInfoResponseData) GetTypeOk() (*MicrosoftTeamsChannelInfoType, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *MicrosoftTeamsChannelInfoResponseData) HasType() bool { + return o != nil && o.Type != nil +} + +// SetType gets a reference to the given MicrosoftTeamsChannelInfoType and assigns it to the Type field. +func (o *MicrosoftTeamsChannelInfoResponseData) SetType(v MicrosoftTeamsChannelInfoType) { + o.Type = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o MicrosoftTeamsChannelInfoResponseData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Attributes != nil { + toSerialize["attributes"] = o.Attributes + } + if o.Id != nil { + toSerialize["id"] = o.Id + } + if o.Type != nil { + toSerialize["type"] = o.Type + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *MicrosoftTeamsChannelInfoResponseData) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *MicrosoftTeamsChannelInfoResponseAttributes `json:"attributes,omitempty"` + Id *string `json:"id,omitempty"` + Type *MicrosoftTeamsChannelInfoType `json:"type,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{"attributes", "id", "type"}) + } else { + return err + } + + hasInvalidField := false + if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Attributes = all.Attributes + o.Id = all.Id + if all.Type != nil && !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = all.Type + } + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_microsoft_teams_channel_info_type.go b/api/datadogV2/model_microsoft_teams_channel_info_type.go new file mode 100644 index 00000000000..eb224f4c057 --- /dev/null +++ b/api/datadogV2/model_microsoft_teams_channel_info_type.go @@ -0,0 +1,64 @@ +// 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 ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// MicrosoftTeamsChannelInfoType Channel info resource type. +type MicrosoftTeamsChannelInfoType string + +// List of MicrosoftTeamsChannelInfoType. +const ( + MICROSOFTTEAMSCHANNELINFOTYPE_MS_TEAMS_CHANNEL_INFO MicrosoftTeamsChannelInfoType = "ms-teams-channel-info" +) + +var allowedMicrosoftTeamsChannelInfoTypeEnumValues = []MicrosoftTeamsChannelInfoType{ + MICROSOFTTEAMSCHANNELINFOTYPE_MS_TEAMS_CHANNEL_INFO, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *MicrosoftTeamsChannelInfoType) GetAllowedValues() []MicrosoftTeamsChannelInfoType { + return allowedMicrosoftTeamsChannelInfoTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *MicrosoftTeamsChannelInfoType) UnmarshalJSON(src []byte) error { + var value string + err := datadog.Unmarshal(src, &value) + if err != nil { + return err + } + *v = MicrosoftTeamsChannelInfoType(value) + return nil +} + +// NewMicrosoftTeamsChannelInfoTypeFromValue returns a pointer to a valid MicrosoftTeamsChannelInfoType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewMicrosoftTeamsChannelInfoTypeFromValue(v string) (*MicrosoftTeamsChannelInfoType, error) { + ev := MicrosoftTeamsChannelInfoType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for MicrosoftTeamsChannelInfoType: valid values are %v", v, allowedMicrosoftTeamsChannelInfoTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v MicrosoftTeamsChannelInfoType) IsValid() bool { + for _, existing := range allowedMicrosoftTeamsChannelInfoTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to MicrosoftTeamsChannelInfoType value. +func (v MicrosoftTeamsChannelInfoType) Ptr() *MicrosoftTeamsChannelInfoType { + return &v +} diff --git a/api/datadogV2/model_microsoft_teams_create_api_handle_request.go b/api/datadogV2/model_microsoft_teams_create_api_handle_request.go new file mode 100644 index 00000000000..a7128942239 --- /dev/null +++ b/api/datadogV2/model_microsoft_teams_create_api_handle_request.go @@ -0,0 +1,110 @@ +// 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 ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// MicrosoftTeamsCreateApiHandleRequest Create handle request. +type MicrosoftTeamsCreateApiHandleRequest struct { + // Handle data from a response. + Data MicrosoftTeamsApiHandleRequestData `json:"data"` + // 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{} `json:"-"` +} + +// NewMicrosoftTeamsCreateApiHandleRequest instantiates a new MicrosoftTeamsCreateApiHandleRequest 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 NewMicrosoftTeamsCreateApiHandleRequest(data MicrosoftTeamsApiHandleRequestData) *MicrosoftTeamsCreateApiHandleRequest { + this := MicrosoftTeamsCreateApiHandleRequest{} + this.Data = data + return &this +} + +// NewMicrosoftTeamsCreateApiHandleRequestWithDefaults instantiates a new MicrosoftTeamsCreateApiHandleRequest 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 NewMicrosoftTeamsCreateApiHandleRequestWithDefaults() *MicrosoftTeamsCreateApiHandleRequest { + this := MicrosoftTeamsCreateApiHandleRequest{} + return &this +} + +// GetData returns the Data field value. +func (o *MicrosoftTeamsCreateApiHandleRequest) GetData() MicrosoftTeamsApiHandleRequestData { + if o == nil { + var ret MicrosoftTeamsApiHandleRequestData + return ret + } + return o.Data +} + +// GetDataOk returns a tuple with the Data field value +// and a boolean to check if the value has been set. +func (o *MicrosoftTeamsCreateApiHandleRequest) GetDataOk() (*MicrosoftTeamsApiHandleRequestData, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *MicrosoftTeamsCreateApiHandleRequest) SetData(v MicrosoftTeamsApiHandleRequestData) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o MicrosoftTeamsCreateApiHandleRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["data"] = o.Data + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *MicrosoftTeamsCreateApiHandleRequest) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *MicrosoftTeamsApiHandleRequestData `json:"data"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } + 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.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 +} diff --git a/api/datadogV2/model_microsoft_teams_create_api_handle_response.go b/api/datadogV2/model_microsoft_teams_create_api_handle_response.go new file mode 100644 index 00000000000..e7a79477b62 --- /dev/null +++ b/api/datadogV2/model_microsoft_teams_create_api_handle_response.go @@ -0,0 +1,110 @@ +// 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 ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// MicrosoftTeamsCreateApiHandleResponse Response of a handle. +type MicrosoftTeamsCreateApiHandleResponse struct { + // Handle data from a response. + Data MicrosoftTeamsApiHandleResponseData `json:"data"` + // 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{} `json:"-"` +} + +// NewMicrosoftTeamsCreateApiHandleResponse instantiates a new MicrosoftTeamsCreateApiHandleResponse 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 NewMicrosoftTeamsCreateApiHandleResponse(data MicrosoftTeamsApiHandleResponseData) *MicrosoftTeamsCreateApiHandleResponse { + this := MicrosoftTeamsCreateApiHandleResponse{} + this.Data = data + return &this +} + +// NewMicrosoftTeamsCreateApiHandleResponseWithDefaults instantiates a new MicrosoftTeamsCreateApiHandleResponse 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 NewMicrosoftTeamsCreateApiHandleResponseWithDefaults() *MicrosoftTeamsCreateApiHandleResponse { + this := MicrosoftTeamsCreateApiHandleResponse{} + return &this +} + +// GetData returns the Data field value. +func (o *MicrosoftTeamsCreateApiHandleResponse) GetData() MicrosoftTeamsApiHandleResponseData { + if o == nil { + var ret MicrosoftTeamsApiHandleResponseData + return ret + } + return o.Data +} + +// GetDataOk returns a tuple with the Data field value +// and a boolean to check if the value has been set. +func (o *MicrosoftTeamsCreateApiHandleResponse) GetDataOk() (*MicrosoftTeamsApiHandleResponseData, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *MicrosoftTeamsCreateApiHandleResponse) SetData(v MicrosoftTeamsApiHandleResponseData) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o MicrosoftTeamsCreateApiHandleResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["data"] = o.Data + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *MicrosoftTeamsCreateApiHandleResponse) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *MicrosoftTeamsApiHandleResponseData `json:"data"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } + 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.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 +} diff --git a/api/datadogV2/model_microsoft_teams_get_channel_by_name_response.go b/api/datadogV2/model_microsoft_teams_get_channel_by_name_response.go new file mode 100644 index 00000000000..943d8f7a526 --- /dev/null +++ b/api/datadogV2/model_microsoft_teams_get_channel_by_name_response.go @@ -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" +) + +// MicrosoftTeamsGetChannelByNameResponse Response with channel, team, and tenant ID information. +type MicrosoftTeamsGetChannelByNameResponse struct { + // Channel data from a response. + Data *MicrosoftTeamsChannelInfoResponseData `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{} `json:"-"` +} + +// NewMicrosoftTeamsGetChannelByNameResponse instantiates a new MicrosoftTeamsGetChannelByNameResponse 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 NewMicrosoftTeamsGetChannelByNameResponse() *MicrosoftTeamsGetChannelByNameResponse { + this := MicrosoftTeamsGetChannelByNameResponse{} + return &this +} + +// NewMicrosoftTeamsGetChannelByNameResponseWithDefaults instantiates a new MicrosoftTeamsGetChannelByNameResponse 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 NewMicrosoftTeamsGetChannelByNameResponseWithDefaults() *MicrosoftTeamsGetChannelByNameResponse { + this := MicrosoftTeamsGetChannelByNameResponse{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *MicrosoftTeamsGetChannelByNameResponse) GetData() MicrosoftTeamsChannelInfoResponseData { + if o == nil || o.Data == nil { + var ret MicrosoftTeamsChannelInfoResponseData + 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 *MicrosoftTeamsGetChannelByNameResponse) GetDataOk() (*MicrosoftTeamsChannelInfoResponseData, 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 *MicrosoftTeamsGetChannelByNameResponse) HasData() bool { + return o != nil && o.Data != nil +} + +// SetData gets a reference to the given MicrosoftTeamsChannelInfoResponseData and assigns it to the Data field. +func (o *MicrosoftTeamsGetChannelByNameResponse) SetData(v MicrosoftTeamsChannelInfoResponseData) { + o.Data = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o MicrosoftTeamsGetChannelByNameResponse) 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 *MicrosoftTeamsGetChannelByNameResponse) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *MicrosoftTeamsChannelInfoResponseData `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 +} diff --git a/api/datadogV2/model_microsoft_teams_update_api_handle_request.go b/api/datadogV2/model_microsoft_teams_update_api_handle_request.go new file mode 100644 index 00000000000..8c7b4b79dcb --- /dev/null +++ b/api/datadogV2/model_microsoft_teams_update_api_handle_request.go @@ -0,0 +1,110 @@ +// 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 ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// MicrosoftTeamsUpdateApiHandleRequest Update handle request. +type MicrosoftTeamsUpdateApiHandleRequest struct { + // Handle data from a response. + Data MicrosoftTeamsUpdateApiHandleRequestData `json:"data"` + // 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{} `json:"-"` +} + +// NewMicrosoftTeamsUpdateApiHandleRequest instantiates a new MicrosoftTeamsUpdateApiHandleRequest 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 NewMicrosoftTeamsUpdateApiHandleRequest(data MicrosoftTeamsUpdateApiHandleRequestData) *MicrosoftTeamsUpdateApiHandleRequest { + this := MicrosoftTeamsUpdateApiHandleRequest{} + this.Data = data + return &this +} + +// NewMicrosoftTeamsUpdateApiHandleRequestWithDefaults instantiates a new MicrosoftTeamsUpdateApiHandleRequest 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 NewMicrosoftTeamsUpdateApiHandleRequestWithDefaults() *MicrosoftTeamsUpdateApiHandleRequest { + this := MicrosoftTeamsUpdateApiHandleRequest{} + return &this +} + +// GetData returns the Data field value. +func (o *MicrosoftTeamsUpdateApiHandleRequest) GetData() MicrosoftTeamsUpdateApiHandleRequestData { + if o == nil { + var ret MicrosoftTeamsUpdateApiHandleRequestData + return ret + } + return o.Data +} + +// GetDataOk returns a tuple with the Data field value +// and a boolean to check if the value has been set. +func (o *MicrosoftTeamsUpdateApiHandleRequest) GetDataOk() (*MicrosoftTeamsUpdateApiHandleRequestData, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *MicrosoftTeamsUpdateApiHandleRequest) SetData(v MicrosoftTeamsUpdateApiHandleRequestData) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o MicrosoftTeamsUpdateApiHandleRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["data"] = o.Data + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *MicrosoftTeamsUpdateApiHandleRequest) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *MicrosoftTeamsUpdateApiHandleRequestData `json:"data"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } + 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.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 +} diff --git a/api/datadogV2/model_microsoft_teams_update_api_handle_request_data.go b/api/datadogV2/model_microsoft_teams_update_api_handle_request_data.go new file mode 100644 index 00000000000..8e808f1c826 --- /dev/null +++ b/api/datadogV2/model_microsoft_teams_update_api_handle_request_data.go @@ -0,0 +1,148 @@ +// 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 ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// MicrosoftTeamsUpdateApiHandleRequestData Handle data from a response. +type MicrosoftTeamsUpdateApiHandleRequestData struct { + // Handle attributes. + Attributes MicrosoftTeamsApiHandleAttributes `json:"attributes"` + // Specifies the handle resource type. + Type MicrosoftTeamsApiHandleType `json:"type"` + // 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{} `json:"-"` +} + +// NewMicrosoftTeamsUpdateApiHandleRequestData instantiates a new MicrosoftTeamsUpdateApiHandleRequestData 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 NewMicrosoftTeamsUpdateApiHandleRequestData(attributes MicrosoftTeamsApiHandleAttributes, typeVar MicrosoftTeamsApiHandleType) *MicrosoftTeamsUpdateApiHandleRequestData { + this := MicrosoftTeamsUpdateApiHandleRequestData{} + this.Attributes = attributes + this.Type = typeVar + return &this +} + +// NewMicrosoftTeamsUpdateApiHandleRequestDataWithDefaults instantiates a new MicrosoftTeamsUpdateApiHandleRequestData 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 NewMicrosoftTeamsUpdateApiHandleRequestDataWithDefaults() *MicrosoftTeamsUpdateApiHandleRequestData { + this := MicrosoftTeamsUpdateApiHandleRequestData{} + var typeVar MicrosoftTeamsApiHandleType = MICROSOFTTEAMSAPIHANDLETYPE_HANDLE + this.Type = typeVar + return &this +} + +// GetAttributes returns the Attributes field value. +func (o *MicrosoftTeamsUpdateApiHandleRequestData) GetAttributes() MicrosoftTeamsApiHandleAttributes { + if o == nil { + var ret MicrosoftTeamsApiHandleAttributes + return ret + } + return o.Attributes +} + +// GetAttributesOk returns a tuple with the Attributes field value +// and a boolean to check if the value has been set. +func (o *MicrosoftTeamsUpdateApiHandleRequestData) GetAttributesOk() (*MicrosoftTeamsApiHandleAttributes, bool) { + if o == nil { + return nil, false + } + return &o.Attributes, true +} + +// SetAttributes sets field value. +func (o *MicrosoftTeamsUpdateApiHandleRequestData) SetAttributes(v MicrosoftTeamsApiHandleAttributes) { + o.Attributes = v +} + +// GetType returns the Type field value. +func (o *MicrosoftTeamsUpdateApiHandleRequestData) GetType() MicrosoftTeamsApiHandleType { + if o == nil { + var ret MicrosoftTeamsApiHandleType + return ret + } + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *MicrosoftTeamsUpdateApiHandleRequestData) GetTypeOk() (*MicrosoftTeamsApiHandleType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *MicrosoftTeamsUpdateApiHandleRequestData) SetType(v MicrosoftTeamsApiHandleType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o MicrosoftTeamsUpdateApiHandleRequestData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["attributes"] = o.Attributes + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *MicrosoftTeamsUpdateApiHandleRequestData) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *MicrosoftTeamsApiHandleAttributes `json:"attributes"` + Type *MicrosoftTeamsApiHandleType `json:"type"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Attributes == nil { + return fmt.Errorf("required field attributes missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "type"}) + } else { + return err + } + + hasInvalidField := false + if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Attributes = *all.Attributes + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/examples/v2/microsoft-teams-integration/CreateApiHandle.go b/examples/v2/microsoft-teams-integration/CreateApiHandle.go new file mode 100644 index 00000000000..a6a2169254a --- /dev/null +++ b/examples/v2/microsoft-teams-integration/CreateApiHandle.go @@ -0,0 +1,40 @@ +// Create handle returns "CREATED" response + +package main + +import ( + "context" + "encoding/json" + "fmt" + "os" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" + "github.com/DataDog/datadog-api-client-go/v2/api/datadogV2" +) + +func main() { + body := datadogV2.MicrosoftTeamsCreateApiHandleRequest{ + Data: datadogV2.MicrosoftTeamsApiHandleRequestData{ + Attributes: datadogV2.MicrosoftTeamsApiHandleRequestAttributes{ + ChannelId: "fake-channel-id", + Name: "fake-handle-name", + TeamId: "00000000-0000-0000-0000-000000000000", + TenantId: "00000000-0000-0000-0000-000000000001", + }, + Type: datadogV2.MICROSOFTTEAMSAPIHANDLETYPE_HANDLE, + }, + } + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewMicrosoftTeamsIntegrationApi(apiClient) + resp, r, err := api.CreateApiHandle(ctx, body) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `MicrosoftTeamsIntegrationApi.CreateApiHandle`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `MicrosoftTeamsIntegrationApi.CreateApiHandle`:\n%s\n", responseContent) +} diff --git a/examples/v2/microsoft-teams-integration/CreateApiHandle_1540689753.go b/examples/v2/microsoft-teams-integration/CreateApiHandle_1540689753.go new file mode 100644 index 00000000000..d960aedb70b --- /dev/null +++ b/examples/v2/microsoft-teams-integration/CreateApiHandle_1540689753.go @@ -0,0 +1,40 @@ +// Create api handle returns "CREATED" response + +package main + +import ( + "context" + "encoding/json" + "fmt" + "os" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" + "github.com/DataDog/datadog-api-client-go/v2/api/datadogV2" +) + +func main() { + body := datadogV2.MicrosoftTeamsCreateApiHandleRequest{ + Data: datadogV2.MicrosoftTeamsApiHandleRequestData{ + Attributes: datadogV2.MicrosoftTeamsApiHandleRequestAttributes{ + ChannelId: "19:iD_D2xy_sAa-JV851JJYwIa6mlW9F9Nxm3SLyZq68qY1@thread.tacv2", + Name: "Example-Microsoft-Teams-Integration", + TeamId: "e5f50a58-c929-4fb3-8866-e2cd836de3c2", + TenantId: "4d3bac44-0230-4732-9e70-cc00736f0a97", + }, + Type: datadogV2.MICROSOFTTEAMSAPIHANDLETYPE_HANDLE, + }, + } + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewMicrosoftTeamsIntegrationApi(apiClient) + resp, r, err := api.CreateApiHandle(ctx, body) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `MicrosoftTeamsIntegrationApi.CreateApiHandle`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `MicrosoftTeamsIntegrationApi.CreateApiHandle`:\n%s\n", responseContent) +} diff --git a/examples/v2/microsoft-teams-integration/DeleteApiHandle.go b/examples/v2/microsoft-teams-integration/DeleteApiHandle.go new file mode 100644 index 00000000000..93be0cf350e --- /dev/null +++ b/examples/v2/microsoft-teams-integration/DeleteApiHandle.go @@ -0,0 +1,25 @@ +// Delete handle returns "OK" response + +package main + +import ( + "context" + "fmt" + "os" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" + "github.com/DataDog/datadog-api-client-go/v2/api/datadogV2" +) + +func main() { + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewMicrosoftTeamsIntegrationApi(apiClient) + r, err := api.DeleteApiHandle(ctx, "handle_id") + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `MicrosoftTeamsIntegrationApi.DeleteApiHandle`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} diff --git a/examples/v2/microsoft-teams-integration/DeleteApiHandle_377884154.go b/examples/v2/microsoft-teams-integration/DeleteApiHandle_377884154.go new file mode 100644 index 00000000000..33607d37b7f --- /dev/null +++ b/examples/v2/microsoft-teams-integration/DeleteApiHandle_377884154.go @@ -0,0 +1,28 @@ +// Delete api handle returns "OK" response + +package main + +import ( + "context" + "fmt" + "os" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" + "github.com/DataDog/datadog-api-client-go/v2/api/datadogV2" +) + +func main() { + // there is a valid "api_handle" in the system + APIHandleDataID := os.Getenv("API_HANDLE_DATA_ID") + + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewMicrosoftTeamsIntegrationApi(apiClient) + r, err := api.DeleteApiHandle(ctx, APIHandleDataID) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `MicrosoftTeamsIntegrationApi.DeleteApiHandle`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} diff --git a/examples/v2/microsoft-teams-integration/GetApiHandle.go b/examples/v2/microsoft-teams-integration/GetApiHandle.go new file mode 100644 index 00000000000..598ce342f58 --- /dev/null +++ b/examples/v2/microsoft-teams-integration/GetApiHandle.go @@ -0,0 +1,29 @@ +// Get handle information returns "OK" response + +package main + +import ( + "context" + "encoding/json" + "fmt" + "os" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" + "github.com/DataDog/datadog-api-client-go/v2/api/datadogV2" +) + +func main() { + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewMicrosoftTeamsIntegrationApi(apiClient) + resp, r, err := api.GetApiHandle(ctx, "handle_id") + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `MicrosoftTeamsIntegrationApi.GetApiHandle`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `MicrosoftTeamsIntegrationApi.GetApiHandle`:\n%s\n", responseContent) +} diff --git a/examples/v2/microsoft-teams-integration/GetApiHandleByName.go b/examples/v2/microsoft-teams-integration/GetApiHandleByName.go new file mode 100644 index 00000000000..23fb4675db9 --- /dev/null +++ b/examples/v2/microsoft-teams-integration/GetApiHandleByName.go @@ -0,0 +1,29 @@ +// Get handle information by name returns "OK" response + +package main + +import ( + "context" + "encoding/json" + "fmt" + "os" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" + "github.com/DataDog/datadog-api-client-go/v2/api/datadogV2" +) + +func main() { + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewMicrosoftTeamsIntegrationApi(apiClient) + resp, r, err := api.GetApiHandleByName(ctx, "handle_name") + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `MicrosoftTeamsIntegrationApi.GetApiHandleByName`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `MicrosoftTeamsIntegrationApi.GetApiHandleByName`:\n%s\n", responseContent) +} diff --git a/examples/v2/microsoft-teams-integration/GetApiHandleByName_1103107145.go b/examples/v2/microsoft-teams-integration/GetApiHandleByName_1103107145.go new file mode 100644 index 00000000000..c251c46b3c8 --- /dev/null +++ b/examples/v2/microsoft-teams-integration/GetApiHandleByName_1103107145.go @@ -0,0 +1,32 @@ +// Get api handle information by name returns "OK" response + +package main + +import ( + "context" + "encoding/json" + "fmt" + "os" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" + "github.com/DataDog/datadog-api-client-go/v2/api/datadogV2" +) + +func main() { + // there is a valid "api_handle" in the system + APIHandleDataAttributesName := os.Getenv("API_HANDLE_DATA_ATTRIBUTES_NAME") + + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewMicrosoftTeamsIntegrationApi(apiClient) + resp, r, err := api.GetApiHandleByName(ctx, APIHandleDataAttributesName) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `MicrosoftTeamsIntegrationApi.GetApiHandleByName`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `MicrosoftTeamsIntegrationApi.GetApiHandleByName`:\n%s\n", responseContent) +} diff --git a/examples/v2/microsoft-teams-integration/GetApiHandle_2883785101.go b/examples/v2/microsoft-teams-integration/GetApiHandle_2883785101.go new file mode 100644 index 00000000000..128e09e3913 --- /dev/null +++ b/examples/v2/microsoft-teams-integration/GetApiHandle_2883785101.go @@ -0,0 +1,32 @@ +// Get api handle information returns "OK" response + +package main + +import ( + "context" + "encoding/json" + "fmt" + "os" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" + "github.com/DataDog/datadog-api-client-go/v2/api/datadogV2" +) + +func main() { + // there is a valid "api_handle" in the system + APIHandleDataID := os.Getenv("API_HANDLE_DATA_ID") + + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewMicrosoftTeamsIntegrationApi(apiClient) + resp, r, err := api.GetApiHandle(ctx, APIHandleDataID) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `MicrosoftTeamsIntegrationApi.GetApiHandle`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `MicrosoftTeamsIntegrationApi.GetApiHandle`:\n%s\n", responseContent) +} diff --git a/examples/v2/microsoft-teams-integration/GetChannelByName.go b/examples/v2/microsoft-teams-integration/GetChannelByName.go new file mode 100644 index 00000000000..71da0142772 --- /dev/null +++ b/examples/v2/microsoft-teams-integration/GetChannelByName.go @@ -0,0 +1,29 @@ +// Get channel information by name returns "OK" response + +package main + +import ( + "context" + "encoding/json" + "fmt" + "os" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" + "github.com/DataDog/datadog-api-client-go/v2/api/datadogV2" +) + +func main() { + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewMicrosoftTeamsIntegrationApi(apiClient) + resp, r, err := api.GetChannelByName(ctx, "tenant_name", "team_name", "channel_name") + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `MicrosoftTeamsIntegrationApi.GetChannelByName`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `MicrosoftTeamsIntegrationApi.GetChannelByName`:\n%s\n", responseContent) +} diff --git a/examples/v2/microsoft-teams-integration/ListApiHandles.go b/examples/v2/microsoft-teams-integration/ListApiHandles.go new file mode 100644 index 00000000000..0934c8dae56 --- /dev/null +++ b/examples/v2/microsoft-teams-integration/ListApiHandles.go @@ -0,0 +1,29 @@ +// Get all handles returns "OK" response + +package main + +import ( + "context" + "encoding/json" + "fmt" + "os" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" + "github.com/DataDog/datadog-api-client-go/v2/api/datadogV2" +) + +func main() { + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewMicrosoftTeamsIntegrationApi(apiClient) + resp, r, err := api.ListApiHandles(ctx, *datadogV2.NewListApiHandlesOptionalParameters()) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `MicrosoftTeamsIntegrationApi.ListApiHandles`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `MicrosoftTeamsIntegrationApi.ListApiHandles`:\n%s\n", responseContent) +} diff --git a/examples/v2/microsoft-teams-integration/ListApiHandles_769592979.go b/examples/v2/microsoft-teams-integration/ListApiHandles_769592979.go new file mode 100644 index 00000000000..4c7adf913f2 --- /dev/null +++ b/examples/v2/microsoft-teams-integration/ListApiHandles_769592979.go @@ -0,0 +1,29 @@ +// Get all api handles returns "OK" response + +package main + +import ( + "context" + "encoding/json" + "fmt" + "os" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" + "github.com/DataDog/datadog-api-client-go/v2/api/datadogV2" +) + +func main() { + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewMicrosoftTeamsIntegrationApi(apiClient) + resp, r, err := api.ListApiHandles(ctx, *datadogV2.NewListApiHandlesOptionalParameters()) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `MicrosoftTeamsIntegrationApi.ListApiHandles`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `MicrosoftTeamsIntegrationApi.ListApiHandles`:\n%s\n", responseContent) +} diff --git a/examples/v2/microsoft-teams-integration/UpdateApiHandle.go b/examples/v2/microsoft-teams-integration/UpdateApiHandle.go new file mode 100644 index 00000000000..da6a68ea4e3 --- /dev/null +++ b/examples/v2/microsoft-teams-integration/UpdateApiHandle.go @@ -0,0 +1,40 @@ +// Update handle returns "OK" response + +package main + +import ( + "context" + "encoding/json" + "fmt" + "os" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" + "github.com/DataDog/datadog-api-client-go/v2/api/datadogV2" +) + +func main() { + body := datadogV2.MicrosoftTeamsUpdateApiHandleRequest{ + Data: datadogV2.MicrosoftTeamsUpdateApiHandleRequestData{ + Attributes: datadogV2.MicrosoftTeamsApiHandleAttributes{ + ChannelId: datadog.PtrString("fake-channel-id"), + Name: datadog.PtrString("fake-handle-name"), + TeamId: datadog.PtrString("00000000-0000-0000-0000-000000000000"), + TenantId: datadog.PtrString("00000000-0000-0000-0000-000000000001"), + }, + Type: datadogV2.MICROSOFTTEAMSAPIHANDLETYPE_HANDLE, + }, + } + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewMicrosoftTeamsIntegrationApi(apiClient) + resp, r, err := api.UpdateApiHandle(ctx, "handle_id", body) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `MicrosoftTeamsIntegrationApi.UpdateApiHandle`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `MicrosoftTeamsIntegrationApi.UpdateApiHandle`:\n%s\n", responseContent) +} diff --git a/examples/v2/microsoft-teams-integration/UpdateApiHandle_419892746.go b/examples/v2/microsoft-teams-integration/UpdateApiHandle_419892746.go new file mode 100644 index 00000000000..46c74aaf827 --- /dev/null +++ b/examples/v2/microsoft-teams-integration/UpdateApiHandle_419892746.go @@ -0,0 +1,40 @@ +// Update api handle returns "OK" response + +package main + +import ( + "context" + "encoding/json" + "fmt" + "os" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" + "github.com/DataDog/datadog-api-client-go/v2/api/datadogV2" +) + +func main() { + // there is a valid "api_handle" in the system + APIHandleDataID := os.Getenv("API_HANDLE_DATA_ID") + + body := datadogV2.MicrosoftTeamsUpdateApiHandleRequest{ + Data: datadogV2.MicrosoftTeamsUpdateApiHandleRequestData{ + Attributes: datadogV2.MicrosoftTeamsApiHandleAttributes{ + Name: datadog.PtrString("fake-handle-name--updated"), + }, + Type: datadogV2.MICROSOFTTEAMSAPIHANDLETYPE_HANDLE, + }, + } + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewMicrosoftTeamsIntegrationApi(apiClient) + resp, r, err := api.UpdateApiHandle(ctx, APIHandleDataID, body) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `MicrosoftTeamsIntegrationApi.UpdateApiHandle`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `MicrosoftTeamsIntegrationApi.UpdateApiHandle`:\n%s\n", responseContent) +} diff --git a/tests/scenarios/api_mappings.go b/tests/scenarios/api_mappings.go index 64468bf739e..fcd6d96bcfa 100644 --- a/tests/scenarios/api_mappings.go +++ b/tests/scenarios/api_mappings.go @@ -64,6 +64,7 @@ var apiMappings = map[string]map[string]reflect.Value{ "EventsApi": reflect.ValueOf(datadogV2.NewEventsApi), "IncidentsApi": reflect.ValueOf(datadogV2.NewIncidentsApi), "GCPIntegrationApi": reflect.ValueOf(datadogV2.NewGCPIntegrationApi), + "MicrosoftTeamsIntegrationApi": reflect.ValueOf(datadogV2.NewMicrosoftTeamsIntegrationApi), "OpsgenieIntegrationApi": reflect.ValueOf(datadogV2.NewOpsgenieIntegrationApi), "CloudflareIntegrationApi": reflect.ValueOf(datadogV2.NewCloudflareIntegrationApi), "ConfluentCloudApi": reflect.ValueOf(datadogV2.NewConfluentCloudApi), diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Microsoft_Teams_Integration/Scenario_Create_api_handle_returns_CREATED_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Microsoft_Teams_Integration/Scenario_Create_api_handle_returns_CREATED_response.freeze new file mode 100644 index 00000000000..032d18d1ad2 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Microsoft_Teams_Integration/Scenario_Create_api_handle_returns_CREATED_response.freeze @@ -0,0 +1 @@ +2024-10-01T14:49:03.835Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Microsoft_Teams_Integration/Scenario_Create_api_handle_returns_CREATED_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Microsoft_Teams_Integration/Scenario_Create_api_handle_returns_CREATED_response.yaml new file mode 100644 index 00000000000..f0129356a6e --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Microsoft_Teams_Integration/Scenario_Create_api_handle_returns_CREATED_response.yaml @@ -0,0 +1,37 @@ +interactions: +- request: + body: | + {"data":{"attributes":{"channel_id":"19:iD_D2xy_sAa-JV851JJYwIa6mlW9F9Nxm3SLyZq68qY1@thread.tacv2","name":"Test-Create_api_handle_returns_CREATED_response-1727794143","team_id":"e5f50a58-c929-4fb3-8866-e2cd836de3c2","tenant_id":"4d3bac44-0230-4732-9e70-cc00736f0a97"},"type":"handle"}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 0 + method: POST + url: https://api.datadoghq.com/api/v2/integration/ms-teams/configuration/tenant-based-handles + response: + body: '{"data":{"id":"4d853924-8004-11ef-a396-da7ad0900002","type":"handle","attributes":{"channel_id":"19:iD_D2xy_sAa-JV851JJYwIa6mlW9F9Nxm3SLyZq68qY1@thread.tacv2","name":"Test-Create_api_handle_returns_CREATED_response-1727794143","team_id":"e5f50a58-c929-4fb3-8866-e2cd836de3c2","tenant_id":"4d3bac44-0230-4732-9e70-cc00736f0a97"}}}' + code: 201 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 201 Created +- request: + body: '' + form: {} + headers: + Accept: + - '*/*' + id: 1 + method: DELETE + url: https://api.datadoghq.com/api/v2/integration/ms-teams/configuration/tenant-based-handles/4d853924-8004-11ef-a396-da7ad0900002 + response: + body: '' + code: 204 + duration: 0ms + headers: {} + status: 204 No Content +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Microsoft_Teams_Integration/Scenario_Delete_api_handle_returns_OK_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Microsoft_Teams_Integration/Scenario_Delete_api_handle_returns_OK_response.freeze new file mode 100644 index 00000000000..c424a36934c --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Microsoft_Teams_Integration/Scenario_Delete_api_handle_returns_OK_response.freeze @@ -0,0 +1 @@ +2024-10-01T14:49:04.126Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Microsoft_Teams_Integration/Scenario_Delete_api_handle_returns_OK_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Microsoft_Teams_Integration/Scenario_Delete_api_handle_returns_OK_response.yaml new file mode 100644 index 00000000000..42c684d8981 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Microsoft_Teams_Integration/Scenario_Delete_api_handle_returns_OK_response.yaml @@ -0,0 +1,52 @@ +interactions: +- request: + body: | + {"data":{"attributes":{"channel_id":"19:iD_D2xy_sAa-JV851JJYwIa6mlW9F9Nxm3SLyZq68qY1@thread.tacv2","name":"Test-Delete_api_handle_returns_OK_response-1727794144","team_id":"e5f50a58-c929-4fb3-8866-e2cd836de3c2","tenant_id":"4d3bac44-0230-4732-9e70-cc00736f0a97"},"type":"handle"}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 0 + method: POST + url: https://api.datadoghq.com/api/v2/integration/ms-teams/configuration/tenant-based-handles + response: + body: '{"data":{"id":"4da666b2-8004-11ef-a397-da7ad0900002","type":"handle","attributes":{"channel_id":"19:iD_D2xy_sAa-JV851JJYwIa6mlW9F9Nxm3SLyZq68qY1@thread.tacv2","name":"Test-Delete_api_handle_returns_OK_response-1727794144","team_id":"e5f50a58-c929-4fb3-8866-e2cd836de3c2","tenant_id":"4d3bac44-0230-4732-9e70-cc00736f0a97"}}}' + code: 201 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 201 Created +- request: + body: '' + form: {} + headers: + Accept: + - '*/*' + id: 1 + method: DELETE + url: https://api.datadoghq.com/api/v2/integration/ms-teams/configuration/tenant-based-handles/4da666b2-8004-11ef-a397-da7ad0900002 + response: + body: '' + code: 204 + duration: 0ms + headers: {} + status: 204 No Content +- request: + body: '' + form: {} + headers: + Accept: + - '*/*' + id: 2 + method: DELETE + url: https://api.datadoghq.com/api/v2/integration/ms-teams/configuration/tenant-based-handles/4da666b2-8004-11ef-a397-da7ad0900002 + response: + body: '' + code: 204 + duration: 0ms + headers: {} + status: 204 No Content +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Microsoft_Teams_Integration/Scenario_Get_all_api_handles_returns_OK_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Microsoft_Teams_Integration/Scenario_Get_all_api_handles_returns_OK_response.freeze new file mode 100644 index 00000000000..e2451a0ca56 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Microsoft_Teams_Integration/Scenario_Get_all_api_handles_returns_OK_response.freeze @@ -0,0 +1 @@ +2024-10-01T14:49:04.412Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Microsoft_Teams_Integration/Scenario_Get_all_api_handles_returns_OK_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Microsoft_Teams_Integration/Scenario_Get_all_api_handles_returns_OK_response.yaml new file mode 100644 index 00000000000..db9170b11b7 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Microsoft_Teams_Integration/Scenario_Get_all_api_handles_returns_OK_response.yaml @@ -0,0 +1,61 @@ +interactions: +- request: + body: | + {"data":{"attributes":{"channel_id":"19:iD_D2xy_sAa-JV851JJYwIa6mlW9F9Nxm3SLyZq68qY1@thread.tacv2","name":"Test-Get_all_api_handles_returns_OK_response-1727794144","team_id":"e5f50a58-c929-4fb3-8866-e2cd836de3c2","tenant_id":"4d3bac44-0230-4732-9e70-cc00736f0a97"},"type":"handle"}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 0 + method: POST + url: https://api.datadoghq.com/api/v2/integration/ms-teams/configuration/tenant-based-handles + response: + body: '{"data":{"id":"4dd2b640-8004-11ef-a398-da7ad0900002","type":"handle","attributes":{"channel_id":"19:iD_D2xy_sAa-JV851JJYwIa6mlW9F9Nxm3SLyZq68qY1@thread.tacv2","name":"Test-Get_all_api_handles_returns_OK_response-1727794144","team_id":"e5f50a58-c929-4fb3-8866-e2cd836de3c2","tenant_id":"4d3bac44-0230-4732-9e70-cc00736f0a97"}}}' + code: 201 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 201 Created +- request: + body: '' + form: {} + headers: + Accept: + - application/json + id: 1 + method: GET + url: https://api.datadoghq.com/api/v2/integration/ms-teams/configuration/tenant-based-handles + response: + body: '{"data":[{"id":"5f002dba-7cd2-11ef-8717-da7ad0900002","type":"ms-teams-handle-info","attributes":{"channel_id":"19:m2LnqTUOkhuzGCyeG_0xql4rbKc2ZSJ25JS6UZINc-01@thread.tacv2","channel_name":"General","name":"test","team_id":"008b01f1-4b68-4e81-b8a9-cfa27ba6c112","team_name":"incident-6252-is_this_a_new_title","tenant_id":"4d3bac44-0230-4732-9e70-cc00736f0a97","tenant_name":"Datadog, + Inc."}},{"id":"9fc79cf6-7ffd-11ef-b391-da7ad0900002","type":"ms-teams-handle-info","attributes":{"channel_id":"19:iD_D2xy_sAa-JV851JJYwIa6mlW9F9Nxm3SLyZq68qY1@thread.tacv2","channel_name":"General-1","name":"TwA43H2NIrilngRZ6dOvNBVNFx4fZvPgdYaroSwcvoObDbJ8RRJtSyKCjkiV2AaVziZSfxNKrL7oV4XHAC0gDv4cuZwGzkv3hJyPGqCuUEHP89CyJMOrtkCRgCM5XeNqoK28J2todRY8ibd3S3xwIwmCK83F2bnBjVB6WEDbmO92F7B9XcIglNwPpy7KMeNRjzxy8Y3c0Ji6jYQIIMRDnawdBGWqCQmGtJ7mFPCHpYlZHKBT7uyV1gIAuGtwIr","team_id":"e5f50a58-c929-4fb3-8866-e2cd836de3c2","team_name":"Chat + Integrations","tenant_id":"4d3bac44-0230-4732-9e70-cc00736f0a97","tenant_name":"Datadog, + Inc."}},{"id":"73ffbd06-8002-11ef-af80-da7ad0900002","type":"ms-teams-handle-info","attributes":{"channel_id":"19:iD_D2xy_sAa-JV851JJYwIa6mlW9F9Nxm3SLyZq68qY1@thread.tacv2","channel_name":"General-1","name":"TwA43H2NIrilngRZ6dOvNBVNFx4fZvPgdYaroSwcvoObDbJ8RRJtSyKCjkiV2AaVziZSfxNKrL7oV4XHAC0gDv4cuZwGzkv3hJyPGqCuUEHP89CyJMOrtkCRgCM5XeNqoK28J2todRY8ibd3S3xwIwmCK83F2bnBjVB6WEDbmO92F7B9XcIglNwPpy7KMeNRjzxy8Y3c0Ji6jYQIIMRDnawdBGWqCQmGtJ7mFPCHpYlZHKBT7uyV1gIAuGtwI","team_id":"e5f50a58-c929-4fb3-8866-e2cd836de3c2","team_name":"Chat + Integrations","tenant_id":"4d3bac44-0230-4732-9e70-cc00736f0a97","tenant_name":"Datadog, + Inc."}},{"id":"4dd2b640-8004-11ef-a398-da7ad0900002","type":"ms-teams-handle-info","attributes":{"channel_id":"19:iD_D2xy_sAa-JV851JJYwIa6mlW9F9Nxm3SLyZq68qY1@thread.tacv2","channel_name":"General-1","name":"Test-Get_all_api_handles_returns_OK_response-1727794144","team_id":"e5f50a58-c929-4fb3-8866-e2cd836de3c2","team_name":"Chat + Integrations","tenant_id":"4d3bac44-0230-4732-9e70-cc00736f0a97","tenant_name":"Datadog, + Inc."}}]}' + code: 200 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 200 OK +- request: + body: '' + form: {} + headers: + Accept: + - '*/*' + id: 2 + method: DELETE + url: https://api.datadoghq.com/api/v2/integration/ms-teams/configuration/tenant-based-handles/4dd2b640-8004-11ef-a398-da7ad0900002 + response: + body: '' + code: 204 + duration: 0ms + headers: {} + status: 204 No Content +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Microsoft_Teams_Integration/Scenario_Get_api_handle_information_by_name_returns_OK_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Microsoft_Teams_Integration/Scenario_Get_api_handle_information_by_name_returns_OK_response.freeze new file mode 100644 index 00000000000..f659c7f4956 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Microsoft_Teams_Integration/Scenario_Get_api_handle_information_by_name_returns_OK_response.freeze @@ -0,0 +1 @@ +2024-10-01T14:49:04.773Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Microsoft_Teams_Integration/Scenario_Get_api_handle_information_by_name_returns_OK_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Microsoft_Teams_Integration/Scenario_Get_api_handle_information_by_name_returns_OK_response.yaml new file mode 100644 index 00000000000..cbeccaeab5e --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Microsoft_Teams_Integration/Scenario_Get_api_handle_information_by_name_returns_OK_response.yaml @@ -0,0 +1,56 @@ +interactions: +- request: + body: | + {"data":{"attributes":{"channel_id":"19:iD_D2xy_sAa-JV851JJYwIa6mlW9F9Nxm3SLyZq68qY1@thread.tacv2","name":"Test-Get_api_handle_information_by_name_returns_OK_response-1727794144","team_id":"e5f50a58-c929-4fb3-8866-e2cd836de3c2","tenant_id":"4d3bac44-0230-4732-9e70-cc00736f0a97"},"type":"handle"}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 0 + method: POST + url: https://api.datadoghq.com/api/v2/integration/ms-teams/configuration/tenant-based-handles + response: + body: '{"data":{"id":"4e084346-8004-11ef-b4b6-da7ad0900002","type":"handle","attributes":{"channel_id":"19:iD_D2xy_sAa-JV851JJYwIa6mlW9F9Nxm3SLyZq68qY1@thread.tacv2","name":"Test-Get_api_handle_information_by_name_returns_OK_response-1727794144","team_id":"e5f50a58-c929-4fb3-8866-e2cd836de3c2","tenant_id":"4d3bac44-0230-4732-9e70-cc00736f0a97"}}}' + code: 201 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 201 Created +- request: + body: '' + form: {} + headers: + Accept: + - application/json + id: 1 + method: GET + url: https://api.datadoghq.com/api/v2/integration/ms-teams/configuration/tenant-based-handles/name/Test-Get_api_handle_information_by_name_returns_OK_response-1727794144 + response: + body: '{"data":{"id":"4e084346-8004-11ef-b4b6-da7ad0900002","type":"ms-teams-handle-info","attributes":{"channel_id":"19:iD_D2xy_sAa-JV851JJYwIa6mlW9F9Nxm3SLyZq68qY1@thread.tacv2","channel_name":"General-1","name":"Test-Get_api_handle_information_by_name_returns_OK_response-1727794144","team_id":"e5f50a58-c929-4fb3-8866-e2cd836de3c2","team_name":"Chat + Integrations","tenant_id":"4d3bac44-0230-4732-9e70-cc00736f0a97","tenant_name":"Datadog, + Inc."}}}' + code: 200 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 200 OK +- request: + body: '' + form: {} + headers: + Accept: + - '*/*' + id: 2 + method: DELETE + url: https://api.datadoghq.com/api/v2/integration/ms-teams/configuration/tenant-based-handles/4e084346-8004-11ef-b4b6-da7ad0900002 + response: + body: '' + code: 204 + duration: 0ms + headers: {} + status: 204 No Content +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Microsoft_Teams_Integration/Scenario_Get_api_handle_information_returns_OK_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Microsoft_Teams_Integration/Scenario_Get_api_handle_information_returns_OK_response.freeze new file mode 100644 index 00000000000..712c03f8798 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Microsoft_Teams_Integration/Scenario_Get_api_handle_information_returns_OK_response.freeze @@ -0,0 +1 @@ +2024-10-01T14:49:05.113Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Microsoft_Teams_Integration/Scenario_Get_api_handle_information_returns_OK_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Microsoft_Teams_Integration/Scenario_Get_api_handle_information_returns_OK_response.yaml new file mode 100644 index 00000000000..2e763d17e0a --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Microsoft_Teams_Integration/Scenario_Get_api_handle_information_returns_OK_response.yaml @@ -0,0 +1,56 @@ +interactions: +- request: + body: | + {"data":{"attributes":{"channel_id":"19:iD_D2xy_sAa-JV851JJYwIa6mlW9F9Nxm3SLyZq68qY1@thread.tacv2","name":"Test-Get_api_handle_information_returns_OK_response-1727794145","team_id":"e5f50a58-c929-4fb3-8866-e2cd836de3c2","tenant_id":"4d3bac44-0230-4732-9e70-cc00736f0a97"},"type":"handle"}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 0 + method: POST + url: https://api.datadoghq.com/api/v2/integration/ms-teams/configuration/tenant-based-handles + response: + body: '{"data":{"id":"4e3c0816-8004-11ef-b813-da7ad0900002","type":"handle","attributes":{"channel_id":"19:iD_D2xy_sAa-JV851JJYwIa6mlW9F9Nxm3SLyZq68qY1@thread.tacv2","name":"Test-Get_api_handle_information_returns_OK_response-1727794145","team_id":"e5f50a58-c929-4fb3-8866-e2cd836de3c2","tenant_id":"4d3bac44-0230-4732-9e70-cc00736f0a97"}}}' + code: 201 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 201 Created +- request: + body: '' + form: {} + headers: + Accept: + - application/json + id: 1 + method: GET + url: https://api.datadoghq.com/api/v2/integration/ms-teams/configuration/tenant-based-handles/4e3c0816-8004-11ef-b813-da7ad0900002 + response: + body: '{"data":{"id":"4e3c0816-8004-11ef-b813-da7ad0900002","type":"ms-teams-handle-info","attributes":{"channel_id":"19:iD_D2xy_sAa-JV851JJYwIa6mlW9F9Nxm3SLyZq68qY1@thread.tacv2","channel_name":"General-1","name":"Test-Get_api_handle_information_returns_OK_response-1727794145","team_id":"e5f50a58-c929-4fb3-8866-e2cd836de3c2","team_name":"Chat + Integrations","tenant_id":"4d3bac44-0230-4732-9e70-cc00736f0a97","tenant_name":"Datadog, + Inc."}}}' + code: 200 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 200 OK +- request: + body: '' + form: {} + headers: + Accept: + - '*/*' + id: 2 + method: DELETE + url: https://api.datadoghq.com/api/v2/integration/ms-teams/configuration/tenant-based-handles/4e3c0816-8004-11ef-b813-da7ad0900002 + response: + body: '' + code: 204 + duration: 0ms + headers: {} + status: 204 No Content +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Microsoft_Teams_Integration/Scenario_Update_api_handle_returns_OK_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Microsoft_Teams_Integration/Scenario_Update_api_handle_returns_OK_response.freeze new file mode 100644 index 00000000000..af5a435fda0 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Microsoft_Teams_Integration/Scenario_Update_api_handle_returns_OK_response.freeze @@ -0,0 +1 @@ +2024-10-01T14:49:05.470Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Microsoft_Teams_Integration/Scenario_Update_api_handle_returns_OK_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Microsoft_Teams_Integration/Scenario_Update_api_handle_returns_OK_response.yaml new file mode 100644 index 00000000000..f372be7b75d --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Microsoft_Teams_Integration/Scenario_Update_api_handle_returns_OK_response.yaml @@ -0,0 +1,59 @@ +interactions: +- request: + body: | + {"data":{"attributes":{"channel_id":"19:iD_D2xy_sAa-JV851JJYwIa6mlW9F9Nxm3SLyZq68qY1@thread.tacv2","name":"Test-Update_api_handle_returns_OK_response-1727794145","team_id":"e5f50a58-c929-4fb3-8866-e2cd836de3c2","tenant_id":"4d3bac44-0230-4732-9e70-cc00736f0a97"},"type":"handle"}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 0 + method: POST + url: https://api.datadoghq.com/api/v2/integration/ms-teams/configuration/tenant-based-handles + response: + body: '{"data":{"id":"4e741fa8-8004-11ef-8fa4-da7ad0900002","type":"handle","attributes":{"channel_id":"19:iD_D2xy_sAa-JV851JJYwIa6mlW9F9Nxm3SLyZq68qY1@thread.tacv2","name":"Test-Update_api_handle_returns_OK_response-1727794145","team_id":"e5f50a58-c929-4fb3-8866-e2cd836de3c2","tenant_id":"4d3bac44-0230-4732-9e70-cc00736f0a97"}}}' + code: 201 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 201 Created +- request: + body: | + {"data":{"attributes":{"name":"Test-Update_api_handle_returns_OK_response-1727794145--updated"},"type":"handle"}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 1 + method: PATCH + url: https://api.datadoghq.com/api/v2/integration/ms-teams/configuration/tenant-based-handles/4e741fa8-8004-11ef-8fa4-da7ad0900002 + response: + body: '{"data":{"id":"4e741fa8-8004-11ef-8fa4-da7ad0900002","type":"ms-teams-handle-info","attributes":{"channel_id":"19:iD_D2xy_sAa-JV851JJYwIa6mlW9F9Nxm3SLyZq68qY1@thread.tacv2","channel_name":"General-1","name":"Test-Update_api_handle_returns_OK_response-1727794145--updated","team_id":"e5f50a58-c929-4fb3-8866-e2cd836de3c2","team_name":"Chat + Integrations","tenant_id":"4d3bac44-0230-4732-9e70-cc00736f0a97","tenant_name":"Datadog, + Inc."}}}' + code: 200 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 200 OK +- request: + body: '' + form: {} + headers: + Accept: + - '*/*' + id: 2 + method: DELETE + url: https://api.datadoghq.com/api/v2/integration/ms-teams/configuration/tenant-based-handles/4e741fa8-8004-11ef-8fa4-da7ad0900002 + response: + body: '' + code: 204 + duration: 0ms + headers: {} + status: 204 No Content +version: 2 diff --git a/tests/scenarios/features/v2/given.json b/tests/scenarios/features/v2/given.json index 65187625d3f..d3652a2a757 100644 --- a/tests/scenarios/features/v2/given.json +++ b/tests/scenarios/features/v2/given.json @@ -212,6 +212,18 @@ "tag": "GCP Integration", "operationId": "CreateGCPSTSAccount" }, + { + "parameters": [ + { + "name": "body", + "value": "{\n \"data\": {\n \"attributes\": {\n \"name\": \"{{ unique }}\",\n \"tenant_id\": \"4d3bac44-0230-4732-9e70-cc00736f0a97\",\n \"team_id\": \"e5f50a58-c929-4fb3-8866-e2cd836de3c2\",\n \"channel_id\": \"19:iD_D2xy_sAa-JV851JJYwIa6mlW9F9Nxm3SLyZq68qY1@thread.tacv2\"\n },\n \"type\": \"handle\"\n }\n}" + } + ], + "step": "there is a valid \"api_handle\" in the system", + "key": "api_handle", + "tag": "Microsoft Teams Integration", + "operationId": "CreateApiHandle" + }, { "parameters": [ { diff --git a/tests/scenarios/features/v2/microsoft_teams_integration.feature b/tests/scenarios/features/v2/microsoft_teams_integration.feature new file mode 100644 index 00000000000..f1a34862f85 --- /dev/null +++ b/tests/scenarios/features/v2/microsoft_teams_integration.feature @@ -0,0 +1,271 @@ +@endpoint(microsoft-teams-integration) @endpoint(microsoft-teams-integration-v2) +Feature: Microsoft Teams Integration + Configure your [Datadog Microsoft Teams + integration](https://docs.datadoghq.com/integrations/microsoft_teams/) + directly through the Datadog API. Note: These endpoints do not support + legacy connector handles. + + Background: + Given a valid "apiKeyAuth" key in the system + And a valid "appKeyAuth" key in the system + And an instance of "MicrosoftTeamsIntegration" API + + @team:DataDog/chat-integrations + Scenario: Create api handle returns "CREATED" response + Given new "CreateApiHandle" request + And body with value {"data": {"attributes": {"channel_id": "19:iD_D2xy_sAa-JV851JJYwIa6mlW9F9Nxm3SLyZq68qY1@thread.tacv2", "name": "{{unique}}", "team_id": "e5f50a58-c929-4fb3-8866-e2cd836de3c2", "tenant_id": "4d3bac44-0230-4732-9e70-cc00736f0a97"}, "type": "handle"}} + When the request is sent + Then the response status is 201 CREATED + And the response "data.attributes.name" is equal to "{{unique}}" + + @generated @skip @team:DataDog/chat-integrations + Scenario: Create handle returns "Bad Request" response + Given new "CreateApiHandle" request + And body with value {"data": {"attributes": {"channel_id": "fake-channel-id", "name": "fake-handle-name", "team_id": "00000000-0000-0000-0000-000000000000", "tenant_id": "00000000-0000-0000-0000-000000000001"}, "type": "handle"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/chat-integrations + Scenario: Create handle returns "CREATED" response + Given new "CreateApiHandle" request + And body with value {"data": {"attributes": {"channel_id": "fake-channel-id", "name": "fake-handle-name", "team_id": "00000000-0000-0000-0000-000000000000", "tenant_id": "00000000-0000-0000-0000-000000000001"}, "type": "handle"}} + When the request is sent + Then the response status is 201 CREATED + + @generated @skip @team:DataDog/chat-integrations + Scenario: Create handle returns "Conflict" response + Given new "CreateApiHandle" request + And body with value {"data": {"attributes": {"channel_id": "fake-channel-id", "name": "fake-handle-name", "team_id": "00000000-0000-0000-0000-000000000000", "tenant_id": "00000000-0000-0000-0000-000000000001"}, "type": "handle"}} + When the request is sent + Then the response status is 409 Conflict + + @generated @skip @team:DataDog/chat-integrations + Scenario: Create handle returns "Failed Precondition" response + Given new "CreateApiHandle" request + And body with value {"data": {"attributes": {"channel_id": "fake-channel-id", "name": "fake-handle-name", "team_id": "00000000-0000-0000-0000-000000000000", "tenant_id": "00000000-0000-0000-0000-000000000001"}, "type": "handle"}} + When the request is sent + Then the response status is 412 Failed Precondition + + @generated @skip @team:DataDog/chat-integrations + Scenario: Create handle returns "Not Found" response + Given new "CreateApiHandle" request + And body with value {"data": {"attributes": {"channel_id": "fake-channel-id", "name": "fake-handle-name", "team_id": "00000000-0000-0000-0000-000000000000", "tenant_id": "00000000-0000-0000-0000-000000000001"}, "type": "handle"}} + When the request is sent + Then the response status is 404 Not Found + + @team:DataDog/chat-integrations + Scenario: Delete api handle returns "OK" response + Given there is a valid "api_handle" in the system + And new "DeleteApiHandle" request + And request contains "handle_id" parameter from "api_handle.data.id" + When the request is sent + Then the response status is 204 OK + + @generated @skip @team:DataDog/chat-integrations + Scenario: Delete handle returns "Bad Request" response + Given new "DeleteApiHandle" request + And request contains "handle_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/chat-integrations + Scenario: Delete handle returns "Failed Precondition" response + Given new "DeleteApiHandle" request + And request contains "handle_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 412 Failed Precondition + + @generated @skip @team:DataDog/chat-integrations + Scenario: Delete handle returns "OK" response + Given new "DeleteApiHandle" request + And request contains "handle_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 204 OK + + @team:DataDog/chat-integrations + Scenario: Get all api handles returns "OK" response + Given there is a valid "api_handle" in the system + And new "ListApiHandles" request + When the request is sent + Then the response status is 200 OK + And the response "data[0].type" is equal to "ms-teams-handle-info" + + @generated @skip @team:DataDog/chat-integrations + Scenario: Get all handles returns "Bad Request" response + Given new "ListApiHandles" request + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/chat-integrations + Scenario: Get all handles returns "Failed Precondition" response + Given new "ListApiHandles" request + When the request is sent + Then the response status is 412 Failed Precondition + + @generated @skip @team:DataDog/chat-integrations + Scenario: Get all handles returns "Not Found" response + Given new "ListApiHandles" request + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/chat-integrations + Scenario: Get all handles returns "OK" response + Given new "ListApiHandles" request + When the request is sent + Then the response status is 200 OK + + @team:DataDog/chat-integrations + Scenario: Get api handle information by name returns "OK" response + Given there is a valid "api_handle" in the system + And new "GetApiHandleByName" request + And request contains "handle_name" parameter from "api_handle.data.attributes.name" + When the request is sent + Then the response status is 200 OK + And the response "data.attributes.channel_id" has the same value as "api_handle.data.attributes.channel_id" + And the response "data.attributes.team_id" has the same value as "api_handle.data.attributes.team_id" + And the response "data.attributes.tenant_id" has the same value as "api_handle.data.attributes.tenant_id" + + @team:DataDog/chat-integrations + Scenario: Get api handle information returns "OK" response + Given there is a valid "api_handle" in the system + And new "GetApiHandle" request + And request contains "handle_id" parameter from "api_handle.data.id" + When the request is sent + Then the response status is 200 OK + And the response "data.attributes.name" has the same value as "api_handle.data.attributes.name" + And the response "data.attributes.channel_id" has the same value as "api_handle.data.attributes.channel_id" + And the response "data.attributes.team_id" has the same value as "api_handle.data.attributes.team_id" + And the response "data.attributes.tenant_id" has the same value as "api_handle.data.attributes.tenant_id" + + @generated @skip @team:DataDog/chat-integrations + Scenario: Get channel information by name returns "Bad Request" response + Given new "GetChannelByName" request + And request contains "tenant_name" parameter from "REPLACE.ME" + And request contains "team_name" parameter from "REPLACE.ME" + And request contains "channel_name" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/chat-integrations + Scenario: Get channel information by name returns "Not Found" response + Given new "GetChannelByName" request + And request contains "tenant_name" parameter from "REPLACE.ME" + And request contains "team_name" parameter from "REPLACE.ME" + And request contains "channel_name" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/chat-integrations + Scenario: Get channel information by name returns "OK" response + Given new "GetChannelByName" request + And request contains "tenant_name" parameter from "REPLACE.ME" + And request contains "team_name" parameter from "REPLACE.ME" + And request contains "channel_name" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/chat-integrations + Scenario: Get handle information by name returns "Bad Request" response + Given new "GetApiHandleByName" request + And request contains "handle_name" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/chat-integrations + Scenario: Get handle information by name returns "Failed Precondition" response + Given new "GetApiHandleByName" request + And request contains "handle_name" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 412 Failed Precondition + + @generated @skip @team:DataDog/chat-integrations + Scenario: Get handle information by name returns "Not Found" response + Given new "GetApiHandleByName" request + And request contains "handle_name" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/chat-integrations + Scenario: Get handle information by name returns "OK" response + Given new "GetApiHandleByName" request + And request contains "handle_name" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/chat-integrations + Scenario: Get handle information returns "Bad Request" response + Given new "GetApiHandle" request + And request contains "handle_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/chat-integrations + Scenario: Get handle information returns "Failed Precondition" response + Given new "GetApiHandle" request + And request contains "handle_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 412 Failed Precondition + + @generated @skip @team:DataDog/chat-integrations + Scenario: Get handle information returns "Not Found" response + Given new "GetApiHandle" request + And request contains "handle_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/chat-integrations + Scenario: Get handle information returns "OK" response + Given new "GetApiHandle" request + And request contains "handle_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK + + @team:DataDog/chat-integrations + Scenario: Update api handle returns "OK" response + Given there is a valid "api_handle" in the system + And new "UpdateApiHandle" request + And request contains "handle_id" parameter from "api_handle.data.id" + And body with value {"data": {"attributes": {"name": "{{api_handle.data.attributes.name}}--updated"}, "type": "handle"}} + When the request is sent + Then the response status is 200 OK + And the response "data.attributes.name" is equal to "{{api_handle.data.attributes.name}}--updated" + + @generated @skip @team:DataDog/chat-integrations + Scenario: Update handle returns "Bad Request" response + Given new "UpdateApiHandle" request + And request contains "handle_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"channel_id": "fake-channel-id", "name": "fake-handle-name", "team_id": "00000000-0000-0000-0000-000000000000", "tenant_id": "00000000-0000-0000-0000-000000000001"}, "type": "handle"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/chat-integrations + Scenario: Update handle returns "Conflict" response + Given new "UpdateApiHandle" request + And request contains "handle_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"channel_id": "fake-channel-id", "name": "fake-handle-name", "team_id": "00000000-0000-0000-0000-000000000000", "tenant_id": "00000000-0000-0000-0000-000000000001"}, "type": "handle"}} + When the request is sent + Then the response status is 409 Conflict + + @generated @skip @team:DataDog/chat-integrations + Scenario: Update handle returns "Failed Precondition" response + Given new "UpdateApiHandle" request + And request contains "handle_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"channel_id": "fake-channel-id", "name": "fake-handle-name", "team_id": "00000000-0000-0000-0000-000000000000", "tenant_id": "00000000-0000-0000-0000-000000000001"}, "type": "handle"}} + When the request is sent + Then the response status is 412 Failed Precondition + + @generated @skip @team:DataDog/chat-integrations + Scenario: Update handle returns "Not Found" response + Given new "UpdateApiHandle" request + And request contains "handle_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"channel_id": "fake-channel-id", "name": "fake-handle-name", "team_id": "00000000-0000-0000-0000-000000000000", "tenant_id": "00000000-0000-0000-0000-000000000001"}, "type": "handle"}} + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/chat-integrations + Scenario: Update handle returns "OK" response + Given new "UpdateApiHandle" request + And request contains "handle_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"channel_id": "fake-channel-id", "name": "fake-handle-name", "team_id": "00000000-0000-0000-0000-000000000000", "tenant_id": "00000000-0000-0000-0000-000000000001"}, "type": "handle"}} + When the request is sent + Then the response status is 200 OK diff --git a/tests/scenarios/features/v2/undo.json b/tests/scenarios/features/v2/undo.json index c8228c1a92e..66c71e9fbb3 100644 --- a/tests/scenarios/features/v2/undo.json +++ b/tests/scenarios/features/v2/undo.json @@ -788,6 +788,55 @@ "type": "idempotent" } }, + "GetChannelByName": { + "tag": "Microsoft Teams Integration", + "undo": { + "type": "safe" + } + }, + "ListApiHandles": { + "tag": "Microsoft Teams Integration", + "undo": { + "type": "safe" + } + }, + "CreateApiHandle": { + "tag": "Microsoft Teams Integration", + "undo": { + "operationId": "DeleteApiHandle", + "parameters": [ + { + "name": "handle_id", + "source": "data.id" + } + ], + "type": "unsafe" + } + }, + "GetApiHandleByName": { + "tag": "Microsoft Teams Integration", + "undo": { + "type": "safe" + } + }, + "DeleteApiHandle": { + "tag": "Microsoft Teams Integration", + "undo": { + "type": "idempotent" + } + }, + "GetApiHandle": { + "tag": "Microsoft Teams Integration", + "undo": { + "type": "safe" + } + }, + "UpdateApiHandle": { + "tag": "Microsoft Teams Integration", + "undo": { + "type": "idempotent" + } + }, "ListOpsgenieServices": { "tag": "Opsgenie Integration", "undo": {