controller.go
controller.go - Overview
-
Overview This file defines the
Controller
struct and its methods for managing integrations. It provides functionalities for listing, retrieving, installing, and uninstalling integrations, as well as retrieving pipelines and dashboards associated with installed integrations. -
Detailed Documentation
Controller
- Purpose: The
Controller
struct is responsible for handling integration-related operations. It holds a reference to theManager
which performs the core logic. - Fields:
mgr
: A pointer to theManager
instance.
NewController
- Purpose: Creates a new
Controller
instance. - Parameters:
sqlStore
(sqlstore.SQLStore
): The SQL store instance.
- Returns:
*Controller
: A pointer to the newly createdController
instance.error
: An error if theManager
cannot be created.
IntegrationsListResponse
- Purpose: Represents the response structure for listing integrations.
- Fields:
Integrations
([]IntegrationsListItem
): A slice ofIntegrationsListItem
representing the integrations.
(c *Controller) ListIntegrations
- Purpose: Lists integrations based on provided filters.
- Parameters:
ctx
(context.Context
): The context.params
(map[string]string
): A map of filter parameters (e.g.,is_installed
).
- Returns:
*IntegrationsListResponse
: A pointer to theIntegrationsListResponse
containing the list of integrations.*model.ApiError
: An API error if any occurred.
(c *Controller) GetIntegration
- Purpose: Retrieves a specific integration by its ID.
- Parameters:
ctx
(context.Context
): The context.integrationId
(string
): The ID of the integration to retrieve.
- Returns:
*Integration
: A pointer to theIntegration
object.*model.ApiError
: An API error if any occurred.
(c *Controller) IsIntegrationInstalled
- Purpose: Checks if an integration is installed.
- Parameters:
ctx
(context.Context
): The context.integrationId
(string
): The ID of the integration to check.
- Returns:
bool
:true
if the integration is installed,false
otherwise.*model.ApiError
: An API error if any occurred.
(c *Controller) GetIntegrationConnectionTests
- Purpose: Retrieves connection tests for a specific integration.
- Parameters:
ctx
(context.Context
): The context.integrationId
(string
): The ID of the integration.
- Returns:
*IntegrationConnectionTests
: A pointer to theIntegrationConnectionTests
object.*model.ApiError
: An API error if any occurred.
InstallIntegrationRequest
- Purpose: Represents the request structure for installing an integration.
- Fields:
IntegrationId
(string
): The ID of the integration to install.Config
(map[string]interface{}
): The configuration for the integration.
(c *Controller) Install
- Purpose: Installs an integration.
- Parameters:
ctx
(context.Context
): The context.req
(*InstallIntegrationRequest
): The install request containing the integration ID and configuration.
- Returns:
*IntegrationsListItem
: A pointer to theIntegrationsListItem
representing the installed integration.*model.ApiError
: An API error if any occurred.
UninstallIntegrationRequest
- Purpose: Represents the request structure for uninstalling an integration.
- Fields:
IntegrationId
(string
): The ID of the integration to uninstall.
(c *Controller) Uninstall
- Purpose: Uninstalls an integration.
- Parameters:
ctx
(context.Context
): The context.req
(*UninstallIntegrationRequest
): The uninstall request containing the integration ID.
- Returns:
*model.ApiError
: An API error if any occurred.
(c *Controller) GetPipelinesForInstalledIntegrations
- Purpose: Retrieves pipelines for installed integrations.
- Parameters:
ctx
(context.Context
): The context.
- Returns:
[]pipelinetypes.GettablePipeline
: A slice ofGettablePipeline
objects.*model.ApiError
: An API error if any occurred.
(c *Controller) GetDashboardsForInstalledIntegrations
- Purpose: Retrieves dashboards for installed integrations.
- Parameters:
ctx
(context.Context
): The context.
- Returns:
[]types.Dashboard
: A slice ofDashboard
objects.*model.ApiError
: An API error if any occurred.
(c *Controller) GetInstalledIntegrationDashboardById
- Purpose: Retrieves a specific installed integration dashboard by its ID.
- Parameters:
ctx
(context.Context
): The context.dashboardUuid
(string
): The UUID of the dashboard.
- Returns:
*types.Dashboard
: A pointer to theDashboard
object.*model.ApiError
: An API error if any occurred.
-
Code Examples None
-
Clarity and Accuracy The documentation is based solely on the code provided.
Include in Getting Started: NO