@@ -12,25 +12,25 @@ import (
1212 "github.com/DataDog/datadog-api-client-go/v2/api/datadog"
1313)
1414
15- // WebhooksIntegrationApi service type
16- type WebhooksIntegrationApi datadog.Service
15+ // SalesforceIntegrationApi service type
16+ type SalesforceIntegrationApi datadog.Service
1717
18- // CreateOAuth2ClientCredentials Create an OAuth2 client credentials auth method .
19- // Create a new OAuth2 client credentials auth method for the Webhooks
20- // integration. The `client_secret` is stored securely and never returned .
21- func (a * WebhooksIntegrationApi ) CreateOAuth2ClientCredentials (ctx _context.Context , body WebhooksOAuth2ClientCredentialsCreateRequest ) (WebhooksOAuth2ClientCredentialsResponse , * _nethttp.Response , error ) {
18+ // CreateIncidentTemplate Create a Salesforce incident template .
19+ // Create a new Salesforce incident template for your organization. Template
20+ // names must be unique within an organization .
21+ func (a * SalesforceIntegrationApi ) CreateIncidentTemplate (ctx _context.Context , body SalesforceIncidentsTemplateCreateRequest ) (SalesforceIncidentsTemplateResponse , * _nethttp.Response , error ) {
2222 var (
2323 localVarHTTPMethod = _nethttp .MethodPost
2424 localVarPostBody interface {}
25- localVarReturnValue WebhooksOAuth2ClientCredentialsResponse
25+ localVarReturnValue SalesforceIncidentsTemplateResponse
2626 )
2727
28- localBasePath , err := a .Client .Cfg .ServerURLWithContext (ctx , "v2.WebhooksIntegrationApi.CreateOAuth2ClientCredentials " )
28+ localBasePath , err := a .Client .Cfg .ServerURLWithContext (ctx , "v2.SalesforceIntegrationApi.CreateIncidentTemplate " )
2929 if err != nil {
3030 return localVarReturnValue , nil , datadog.GenericOpenAPIError {ErrorMessage : err .Error ()}
3131 }
3232
33- localVarPath := localBasePath + "/api/v2/integration/webhooks/configuration/auth-method/oauth2-client-credentials "
33+ localVarPath := localBasePath + "/api/v2/integration/salesforce-incidents/incident-templates "
3434
3535 localVarHeaderParams := make (map [string ]string )
3636 localVarQueryParams := _neturl.Values {}
@@ -73,7 +73,7 @@ func (a *WebhooksIntegrationApi) CreateOAuth2ClientCredentials(ctx _context.Cont
7373 ErrorBody : localVarBody ,
7474 ErrorMessage : localVarHTTPResponse .Status ,
7575 }
76- if localVarHTTPResponse .StatusCode == 400 || localVarHTTPResponse .StatusCode == 403 || localVarHTTPResponse .StatusCode == 409 || localVarHTTPResponse .StatusCode == 429 {
76+ if localVarHTTPResponse .StatusCode == 400 || localVarHTTPResponse .StatusCode == 403 || localVarHTTPResponse .StatusCode == 404 || localVarHTTPResponse . StatusCode == 409 || localVarHTTPResponse .StatusCode == 429 {
7777 var v APIErrorResponse
7878 err = a .Client .Decode (& v , localVarBody , localVarHTTPResponse .Header .Get ("Content-Type" ))
7979 if err != nil {
@@ -96,21 +96,21 @@ func (a *WebhooksIntegrationApi) CreateOAuth2ClientCredentials(ctx _context.Cont
9696 return localVarReturnValue , localVarHTTPResponse , nil
9797}
9898
99- // DeleteOAuth2ClientCredentials Delete an OAuth2 client credentials auth method .
100- // Delete an OAuth2 client credentials auth method by ID .
101- func (a * WebhooksIntegrationApi ) DeleteOAuth2ClientCredentials (ctx _context.Context , authMethodId string ) (* _nethttp.Response , error ) {
99+ // DeleteIncidentTemplate Delete a Salesforce incident template .
100+ // Delete a single Salesforce incident template from your organization .
101+ func (a * SalesforceIntegrationApi ) DeleteIncidentTemplate (ctx _context.Context , incidentTemplateId string ) (* _nethttp.Response , error ) {
102102 var (
103103 localVarHTTPMethod = _nethttp .MethodDelete
104104 localVarPostBody interface {}
105105 )
106106
107- localBasePath , err := a .Client .Cfg .ServerURLWithContext (ctx , "v2.WebhooksIntegrationApi.DeleteOAuth2ClientCredentials " )
107+ localBasePath , err := a .Client .Cfg .ServerURLWithContext (ctx , "v2.SalesforceIntegrationApi.DeleteIncidentTemplate " )
108108 if err != nil {
109109 return nil , datadog.GenericOpenAPIError {ErrorMessage : err .Error ()}
110110 }
111111
112- localVarPath := localBasePath + "/api/v2/integration/webhooks/configuration/auth-method/oauth2-client-credentials/{auth_method_id }"
113- localVarPath = datadog .ReplacePathParameter (localVarPath , "{auth_method_id }" , _neturl .PathEscape (datadog .ParameterToString (authMethodId , "" )))
112+ localVarPath := localBasePath + "/api/v2/integration/salesforce-incidents/incident-templates/{incident_template_id }"
113+ localVarPath = datadog .ReplacePathParameter (localVarPath , "{incident_template_id }" , _neturl .PathEscape (datadog .ParameterToString (incidentTemplateId , "" )))
114114
115115 localVarHeaderParams := make (map [string ]string )
116116 localVarQueryParams := _neturl.Values {}
@@ -164,54 +164,94 @@ func (a *WebhooksIntegrationApi) DeleteOAuth2ClientCredentials(ctx _context.Cont
164164 return localVarHTTPResponse , nil
165165}
166166
167- // GetAllAuthMethodsOptionalParameters holds optional parameters for GetAllAuthMethods.
168- type GetAllAuthMethodsOptionalParameters struct {
169- Include * WebhooksAuthMethodProtocol
170- }
167+ // DeleteSalesforceOrganization Delete a connected Salesforce organization.
168+ // Disconnect a Salesforce organization from your Datadog organization.
169+ // This also deletes any incident templates referencing the organization.
170+ func (a * SalesforceIntegrationApi ) DeleteSalesforceOrganization (ctx _context.Context , salesforceOrgId string ) (* _nethttp.Response , error ) {
171+ var (
172+ localVarHTTPMethod = _nethttp .MethodDelete
173+ localVarPostBody interface {}
174+ )
171175
172- // NewGetAllAuthMethodsOptionalParameters creates an empty struct for parameters.
173- func NewGetAllAuthMethodsOptionalParameters () * GetAllAuthMethodsOptionalParameters {
174- this := GetAllAuthMethodsOptionalParameters {}
175- return & this
176- }
176+ localBasePath , err := a .Client .Cfg .ServerURLWithContext (ctx , "v2.SalesforceIntegrationApi.DeleteSalesforceOrganization" )
177+ if err != nil {
178+ return nil , datadog.GenericOpenAPIError {ErrorMessage : err .Error ()}
179+ }
180+
181+ localVarPath := localBasePath + "/api/v2/integration/salesforce-incidents/organizations/{salesforce_org_id}"
182+ localVarPath = datadog .ReplacePathParameter (localVarPath , "{salesforce_org_id}" , _neturl .PathEscape (datadog .ParameterToString (salesforceOrgId , "" )))
183+
184+ localVarHeaderParams := make (map [string ]string )
185+ localVarQueryParams := _neturl.Values {}
186+ localVarFormParams := _neturl.Values {}
187+ localVarHeaderParams ["Accept" ] = "*/*"
177188
178- // WithInclude sets the corresponding parameter name and returns the struct.
179- func (r * GetAllAuthMethodsOptionalParameters ) WithInclude (include WebhooksAuthMethodProtocol ) * GetAllAuthMethodsOptionalParameters {
180- r .Include = & include
181- return r
189+ if a .Client .Cfg .DelegatedTokenConfig != nil {
190+ err = datadog .UseDelegatedTokenAuth (ctx , & localVarHeaderParams , a .Client .Cfg .DelegatedTokenConfig )
191+ if err != nil {
192+ return nil , err
193+ }
194+ } else {
195+ datadog .SetAuthKeys (
196+ ctx ,
197+ & localVarHeaderParams ,
198+ [2 ]string {"apiKeyAuth" , "DD-API-KEY" },
199+ [2 ]string {"appKeyAuth" , "DD-APPLICATION-KEY" },
200+ )
201+ }
202+ req , err := a .Client .PrepareRequest (ctx , localVarPath , localVarHTTPMethod , localVarPostBody , localVarHeaderParams , localVarQueryParams , localVarFormParams , nil )
203+ if err != nil {
204+ return nil , err
205+ }
206+
207+ localVarHTTPResponse , err := a .Client .CallAPI (req )
208+ if err != nil || localVarHTTPResponse == nil {
209+ return localVarHTTPResponse , err
210+ }
211+
212+ localVarBody , err := datadog .ReadBody (localVarHTTPResponse )
213+ if err != nil {
214+ return localVarHTTPResponse , err
215+ }
216+
217+ if localVarHTTPResponse .StatusCode >= 300 {
218+ newErr := datadog.GenericOpenAPIError {
219+ ErrorBody : localVarBody ,
220+ ErrorMessage : localVarHTTPResponse .Status ,
221+ }
222+ if localVarHTTPResponse .StatusCode == 400 || localVarHTTPResponse .StatusCode == 403 || localVarHTTPResponse .StatusCode == 404 || localVarHTTPResponse .StatusCode == 429 {
223+ var v APIErrorResponse
224+ err = a .Client .Decode (& v , localVarBody , localVarHTTPResponse .Header .Get ("Content-Type" ))
225+ if err != nil {
226+ return localVarHTTPResponse , newErr
227+ }
228+ newErr .ErrorModel = v
229+ }
230+ return localVarHTTPResponse , newErr
231+ }
232+
233+ return localVarHTTPResponse , nil
182234}
183235
184- // GetAllAuthMethods Get all auth methods.
185- // Get a list of all auth methods configured for the Webhooks integration in
186- // your organization.
187- func (a * WebhooksIntegrationApi ) GetAllAuthMethods (ctx _context.Context , o ... GetAllAuthMethodsOptionalParameters ) (WebhooksAuthMethodsResponse , * _nethttp.Response , error ) {
236+ // GetIncidentTemplates Get all Salesforce incident templates.
237+ // Get all Salesforce incident templates configured for your organization.
238+ func (a * SalesforceIntegrationApi ) GetIncidentTemplates (ctx _context.Context ) (SalesforceIncidentsTemplatesResponse , * _nethttp.Response , error ) {
188239 var (
189240 localVarHTTPMethod = _nethttp .MethodGet
190241 localVarPostBody interface {}
191- localVarReturnValue WebhooksAuthMethodsResponse
192- optionalParams GetAllAuthMethodsOptionalParameters
242+ localVarReturnValue SalesforceIncidentsTemplatesResponse
193243 )
194244
195- if len (o ) > 1 {
196- return localVarReturnValue , nil , datadog .ReportError ("only one argument of type GetAllAuthMethodsOptionalParameters is allowed" )
197- }
198- if len (o ) == 1 {
199- optionalParams = o [0 ]
200- }
201-
202- localBasePath , err := a .Client .Cfg .ServerURLWithContext (ctx , "v2.WebhooksIntegrationApi.GetAllAuthMethods" )
245+ localBasePath , err := a .Client .Cfg .ServerURLWithContext (ctx , "v2.SalesforceIntegrationApi.GetIncidentTemplates" )
203246 if err != nil {
204247 return localVarReturnValue , nil , datadog.GenericOpenAPIError {ErrorMessage : err .Error ()}
205248 }
206249
207- localVarPath := localBasePath + "/api/v2/integration/webhooks/configuration/auth-method "
250+ localVarPath := localBasePath + "/api/v2/integration/salesforce-incidents/incident-templates "
208251
209252 localVarHeaderParams := make (map [string ]string )
210253 localVarQueryParams := _neturl.Values {}
211254 localVarFormParams := _neturl.Values {}
212- if optionalParams .Include != nil {
213- localVarQueryParams .Add ("include" , datadog .ParameterToString (* optionalParams .Include , "" ))
214- }
215255 localVarHeaderParams ["Accept" ] = "application/json"
216256
217257 if a .Client .Cfg .DelegatedTokenConfig != nil {
@@ -270,22 +310,23 @@ func (a *WebhooksIntegrationApi) GetAllAuthMethods(ctx _context.Context, o ...Ge
270310 return localVarReturnValue , localVarHTTPResponse , nil
271311}
272312
273- // GetOAuth2ClientCredentials Get an OAuth2 client credentials auth method.
274- // Get a single OAuth2 client credentials auth method by ID.
275- func (a * WebhooksIntegrationApi ) GetOAuth2ClientCredentials (ctx _context.Context , authMethodId string ) (WebhooksOAuth2ClientCredentialsResponse , * _nethttp.Response , error ) {
313+ // GetSalesforceOrganizations Get all connected Salesforce organizations.
314+ // Get all Salesforce organizations connected to your Datadog organization
315+ // through the Salesforce integration. Salesforce organizations are connected
316+ // through the OAuth setup flow in the Datadog Salesforce integration page.
317+ func (a * SalesforceIntegrationApi ) GetSalesforceOrganizations (ctx _context.Context ) (SalesforceIncidentsOrganizationsResponse , * _nethttp.Response , error ) {
276318 var (
277319 localVarHTTPMethod = _nethttp .MethodGet
278320 localVarPostBody interface {}
279- localVarReturnValue WebhooksOAuth2ClientCredentialsResponse
321+ localVarReturnValue SalesforceIncidentsOrganizationsResponse
280322 )
281323
282- localBasePath , err := a .Client .Cfg .ServerURLWithContext (ctx , "v2.WebhooksIntegrationApi.GetOAuth2ClientCredentials " )
324+ localBasePath , err := a .Client .Cfg .ServerURLWithContext (ctx , "v2.SalesforceIntegrationApi.GetSalesforceOrganizations " )
283325 if err != nil {
284326 return localVarReturnValue , nil , datadog.GenericOpenAPIError {ErrorMessage : err .Error ()}
285327 }
286328
287- localVarPath := localBasePath + "/api/v2/integration/webhooks/configuration/auth-method/oauth2-client-credentials/{auth_method_id}"
288- localVarPath = datadog .ReplacePathParameter (localVarPath , "{auth_method_id}" , _neturl .PathEscape (datadog .ParameterToString (authMethodId , "" )))
329+ localVarPath := localBasePath + "/api/v2/integration/salesforce-incidents/organizations"
289330
290331 localVarHeaderParams := make (map [string ]string )
291332 localVarQueryParams := _neturl.Values {}
@@ -325,7 +366,7 @@ func (a *WebhooksIntegrationApi) GetOAuth2ClientCredentials(ctx _context.Context
325366 ErrorBody : localVarBody ,
326367 ErrorMessage : localVarHTTPResponse .Status ,
327368 }
328- if localVarHTTPResponse .StatusCode == 403 || localVarHTTPResponse .StatusCode == 404 || localVarHTTPResponse .StatusCode == 429 {
369+ if localVarHTTPResponse .StatusCode == 400 || localVarHTTPResponse . StatusCode == 403 || localVarHTTPResponse .StatusCode == 404 || localVarHTTPResponse .StatusCode == 429 {
329370 var v APIErrorResponse
330371 err = a .Client .Decode (& v , localVarBody , localVarHTTPResponse .Header .Get ("Content-Type" ))
331372 if err != nil {
@@ -348,22 +389,22 @@ func (a *WebhooksIntegrationApi) GetOAuth2ClientCredentials(ctx _context.Context
348389 return localVarReturnValue , localVarHTTPResponse , nil
349390}
350391
351- // UpdateOAuth2ClientCredentials Update an OAuth2 client credentials auth method .
352- // Update an existing OAuth2 client credentials auth method .
353- func (a * WebhooksIntegrationApi ) UpdateOAuth2ClientCredentials (ctx _context.Context , authMethodId string , body WebhooksOAuth2ClientCredentialsUpdateRequest ) (WebhooksOAuth2ClientCredentialsResponse , * _nethttp.Response , error ) {
392+ // UpdateIncidentTemplate Update a Salesforce incident template .
393+ // Update a single Salesforce incident template in your organization .
394+ func (a * SalesforceIntegrationApi ) UpdateIncidentTemplate (ctx _context.Context , incidentTemplateId string , body SalesforceIncidentsTemplateUpdateRequest ) (SalesforceIncidentsTemplateResponse , * _nethttp.Response , error ) {
354395 var (
355396 localVarHTTPMethod = _nethttp .MethodPatch
356397 localVarPostBody interface {}
357- localVarReturnValue WebhooksOAuth2ClientCredentialsResponse
398+ localVarReturnValue SalesforceIncidentsTemplateResponse
358399 )
359400
360- localBasePath , err := a .Client .Cfg .ServerURLWithContext (ctx , "v2.WebhooksIntegrationApi.UpdateOAuth2ClientCredentials " )
401+ localBasePath , err := a .Client .Cfg .ServerURLWithContext (ctx , "v2.SalesforceIntegrationApi.UpdateIncidentTemplate " )
361402 if err != nil {
362403 return localVarReturnValue , nil , datadog.GenericOpenAPIError {ErrorMessage : err .Error ()}
363404 }
364405
365- localVarPath := localBasePath + "/api/v2/integration/webhooks/configuration/auth-method/oauth2-client-credentials/{auth_method_id }"
366- localVarPath = datadog .ReplacePathParameter (localVarPath , "{auth_method_id }" , _neturl .PathEscape (datadog .ParameterToString (authMethodId , "" )))
406+ localVarPath := localBasePath + "/api/v2/integration/salesforce-incidents/incident-templates/{incident_template_id }"
407+ localVarPath = datadog .ReplacePathParameter (localVarPath , "{incident_template_id }" , _neturl .PathEscape (datadog .ParameterToString (incidentTemplateId , "" )))
367408
368409 localVarHeaderParams := make (map [string ]string )
369410 localVarQueryParams := _neturl.Values {}
@@ -429,9 +470,9 @@ func (a *WebhooksIntegrationApi) UpdateOAuth2ClientCredentials(ctx _context.Cont
429470 return localVarReturnValue , localVarHTTPResponse , nil
430471}
431472
432- // NewWebhooksIntegrationApi Returns NewWebhooksIntegrationApi .
433- func NewWebhooksIntegrationApi (client * datadog.APIClient ) * WebhooksIntegrationApi {
434- return & WebhooksIntegrationApi {
473+ // NewSalesforceIntegrationApi Returns NewSalesforceIntegrationApi .
474+ func NewSalesforceIntegrationApi (client * datadog.APIClient ) * SalesforceIntegrationApi {
475+ return & SalesforceIntegrationApi {
435476 Client : client ,
436477 }
437478}
0 commit comments