From 62a316b634710278969070ba043ca831cb83c05d Mon Sep 17 00:00:00 2001 From: Ilya Rubnich Date: Mon, 6 Jan 2025 12:08:59 -0500 Subject: [PATCH] wire up actual client --- datadog/fwprovider/data_source_datadog_connection.go | 4 ++-- datadog/fwprovider/resource_datadog_connection.go | 4 ++-- datadog/internal/utils/api_instances_helper.go | 9 +++++++++ 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/datadog/fwprovider/data_source_datadog_connection.go b/datadog/fwprovider/data_source_datadog_connection.go index 31c2e601c..862bc2414 100644 --- a/datadog/fwprovider/data_source_datadog_connection.go +++ b/datadog/fwprovider/data_source_datadog_connection.go @@ -12,7 +12,7 @@ import ( var _ datasource.DataSource = &connectionDatasource{} type connectionDatasource struct { - Api *datadogV2.TeamsApi + Api *datadogV2.ActionConnectionApi Auth context.Context } @@ -22,7 +22,7 @@ func NewDatadogConnectionDataSource() datasource.DataSource { func (d *connectionDatasource) Configure(_ context.Context, request datasource.ConfigureRequest, response *datasource.ConfigureResponse) { providerData := request.ProviderData.(*FrameworkProvider) - d.Api = providerData.DatadogApiInstances.GetTeamsApiV2() + d.Api = providerData.DatadogApiInstances.GetActionConnectionApiV2() d.Auth = providerData.Auth } diff --git a/datadog/fwprovider/resource_datadog_connection.go b/datadog/fwprovider/resource_datadog_connection.go index c6921a06a..11c2c15dc 100644 --- a/datadog/fwprovider/resource_datadog_connection.go +++ b/datadog/fwprovider/resource_datadog_connection.go @@ -20,7 +20,7 @@ var ( ) type connectionResource struct { - Api *datadogV2.TeamsApi + Api *datadogV2.ActionConnectionApi Auth context.Context } @@ -81,7 +81,7 @@ func NewConnectionResource() resource.Resource { func (r *connectionResource) Configure(_ context.Context, request resource.ConfigureRequest, response *resource.ConfigureResponse) { providerData := request.ProviderData.(*FrameworkProvider) - r.Api = providerData.DatadogApiInstances.GetTeamsApiV2() + r.Api = providerData.DatadogApiInstances.GetActionConnectionApiV2() r.Auth = providerData.Auth } diff --git a/datadog/internal/utils/api_instances_helper.go b/datadog/internal/utils/api_instances_helper.go index fe4babc6f..28fdd9a95 100644 --- a/datadog/internal/utils/api_instances_helper.go +++ b/datadog/internal/utils/api_instances_helper.go @@ -44,6 +44,7 @@ type ApiInstances struct { webhooksIntegrationApiV1 *datadogV1.WebhooksIntegrationApi //V2 APIs + actionConnectionApiV2 *datadogV2.ActionConnectionApi apiManagementAPIV2 *datadogV2.APIManagementApi apmRetentionFiltersApiV2 *datadogV2.APMRetentionFiltersApi auditApiV2 *datadogV2.AuditApi @@ -680,3 +681,11 @@ func (i *ApiInstances) GetMicrosoftTeamsIntegrationApiV2() *datadogV2.MicrosoftT } return i.microsoftTeamsIntegrationApiV2 } + +// GetActionConnectionApiV2 get instance of ActionConnectionApi +func (i *ApiInstances) GetActionConnectionApiV2() *datadogV2.ActionConnectionApi { + if i.actionConnectionApiV2 == nil { + i.actionConnectionApiV2 = datadogV2.NewActionConnectionApi(i.HttpClient) + } + return i.actionConnectionApiV2 +}