SigNoz is an open-source, OpenTelemetry-native observability platform for your team and their AI agents. Get logs, metrics, and traces in one tool with features like APM, distributed tracing, log management, infra monitoring, etc. Combined with SigNoz MCP and a native AI teammate (in SigNoz Cloud) it helps you build more resilient apps.
TypeScript apmapplication-monitoringdistributed-tracinggogood-first-issuejaegerloglogsmetricsmonitoringnextjsobservabilityopen-sourceopentelemetryprometheusreactreactjsself-hostedtracingtypescript
feat: adding cloud integration azure types and openapi spec (#11005)
swapnil-signoz21ce7a663a07
diff --git a/docs/api/openapi.yml b/docs/api/openapi.ymlindex 3490e53fb0..812cd6aa9d 100644--- a/docs/api/openapi.yml+++ b/docs/api/openapi.yml@@ -668,8 +668,8 @@ components:properties:aws:$ref: '#/components/schemas/CloudintegrationtypesAWSAccountConfig'- required:- - aws+ azure:+ $ref: '#/components/schemas/CloudintegrationtypesAzureAccountConfig'type: objectCloudintegrationtypesAgentReport:nullable: true@@ -693,6 +693,90 @@ components:nullable: truetype: arraytype: object+ CloudintegrationtypesAzureAccountConfig:+ properties:+ deploymentRegion:+ type: string+ resourceGroups:+ items:+ type: string+ type: array+ required:+ - deploymentRegion+ - resourceGroups+ type: object+ CloudintegrationtypesAzureConnectionArtifact:+ properties:+ cliCommand:+ type: string+ cloudPowerShellCommand:+ type: string+ required:+ - cliCommand+ - cloudPowerShellCommand+ type: object+ CloudintegrationtypesAzureIntegrationConfig:+ properties:+ deploymentRegion:+ type: string+ resourceGroups:+ items:+ type: string+ type: array+ telemetryCollectionStrategy:+ items:+ $ref: '#/components/schemas/CloudintegrationtypesAzureTelemetryCollectionStrategy'+ type: array+ required:+ - deploymentRegion+ - resourceGroups+ - telemetryCollectionStrategy+ type: object+ CloudintegrationtypesAzureLogsCollectionStrategy:+ properties:+ categoryGroups:+ items:+ type: string+ type: array+ required:+ - categoryGroups+ type: object+ CloudintegrationtypesAzureMetricsCollectionStrategy:+ type: object+ CloudintegrationtypesAzureServiceConfig:+ properties:+ logs:+ $ref: '#/components/schemas/CloudintegrationtypesAzureServiceLogsConfig'+ metrics:+ $ref: '#/components/schemas/CloudintegrationtypesAzureServiceMetricsConfig'+ required:+ - logs+ - metrics+ type: object+ CloudintegrationtypesAzureServiceLogsConfig:+ properties:+ enabled:+ type: boolean+ type: object+ CloudintegrationtypesAzureServiceMetricsConfig:+ properties:+ enabled:+ type: boolean+ type: object+ CloudintegrationtypesAzureTelemetryCollectionStrategy:+ properties:+ logs:+ $ref: '#/components/schemas/CloudintegrationtypesAzureLogsCollectionStrategy'+ metrics:+ $ref: '#/components/schemas/CloudintegrationtypesAzureMetricsCollectionStrategy'+ resourceProvider:+ type: string+ resourceType:+ type: string+ required:+ - resourceProvider+ - resourceType+ type: objectCloudintegrationtypesCloudIntegrationService:nullable: trueproperties:@@ -737,8 +821,8 @@ components:properties:aws:$ref: '#/components/schemas/CloudintegrationtypesAWSConnectionArtifact'- required:- - aws+ azure:+ $ref: '#/components/schemas/CloudintegrationtypesAzureConnectionArtifact'type: objectCloudintegrationtypesCredentials:properties:@@ -910,8 +994,8 @@ components:properties:aws:$ref: '#/components/schemas/CloudintegrationtypesAWSPostableAccountConfig'- required:- - aws+ azure:+ $ref: '#/components/schemas/CloudintegrationtypesAzureAccountConfig'type: objectCloudintegrationtypesPostableAgentCheckIn:properties:@@ -934,8 +1018,8 @@ components:properties:aws:$ref: '#/components/schemas/CloudintegrationtypesAWSIntegrationConfig'- required:- - aws+ azure:+ $ref: '#/components/schemas/CloudintegrationtypesAzureIntegrationConfig'type: objectCloudintegrationtypesService:properties:@@ -972,8 +1056,8 @@ components:properties:aws:$ref: '#/components/schemas/CloudintegrationtypesAWSServiceConfig'- required:- - aws+ azure:+ $ref: '#/components/schemas/CloudintegrationtypesAzureServiceConfig'type: objectCloudintegrationtypesServiceID:enum:@@ -990,6 +1074,8 @@ components:- s3sync- sns- sqs+ - storageaccountsblob+ - cdnprofiletype: stringCloudintegrationtypesServiceMetadata:properties:@@ -1018,16 +1104,32 @@ components:properties:aws:$ref: '#/components/schemas/CloudintegrationtypesAWSTelemetryCollectionStrategy'- required:- - aws+ azure:+ $ref: '#/components/schemas/CloudintegrationtypesAzureTelemetryCollectionStrategy'type: objectCloudintegrationtypesUpdatableAccount:properties:config:- $ref: '#/components/schemas/CloudintegrationtypesAccountConfig'+ $ref: '#/components/schemas/CloudintegrationtypesUpdatableAccountConfig'required:- configtype: object+ CloudintegrationtypesUpdatableAccountConfig:+ properties:+ aws:+ $ref: '#/components/schemas/CloudintegrationtypesAWSAccountConfig'+ azure:+ $ref: '#/components/schemas/CloudintegrationtypesUpdatableAzureAccountConfig'+ type: object+ CloudintegrationtypesUpdatableAzureAccountConfig:+ properties:+ resourceGroups:+ items:+ type: string+ type: array+ required:+ - resourceGroups+ type: objectCloudintegrationtypesUpdatableService:properties:config:diff --git a/frontend/src/api/generated/services/sigNoz.schemas.ts b/frontend/src/api/generated/services/sigNoz.schemas.tsindex f1bd8a84e8..69562e78e7 100644--- a/frontend/src/api/generated/services/sigNoz.schemas.ts+++ b/frontend/src/api/generated/services/sigNoz.schemas.ts@@ -795,7 +795,8 @@ export interface CloudintegrationtypesAccountDTO {}export interface CloudintegrationtypesAccountConfigDTO {- aws: CloudintegrationtypesAWSAccountConfigDTO;+ aws?: CloudintegrationtypesAWSAccountConfigDTO;+ azure?: CloudintegrationtypesAzureAccountConfigDTO;}/**@@ -829,6 +830,86 @@ export interface CloudintegrationtypesAssetsDTO {dashboards?: CloudintegrationtypesDashboardDTO[] | null;}+export interface CloudintegrationtypesAzureAccountConfigDTO {+ /**+ * @type string+ */+ deploymentRegion: string;+ /**+ * @type array+ */+ resourceGroups: string[];+}++export interface CloudintegrationtypesAzureConnectionArtifactDTO {+ /**+ * @type string+ */+ cliCommand: string;+ /**+ * @type string+ */+ cloudPowerShellCommand: string;+}++export interface CloudintegrationtypesAzureIntegrationConfigDTO {+ /**+ * @type string+ */+ deploymentRegion: string;+ /**+ * @type array+ */+ resourceGroups: string[];+ /**+ * @type array+ */+ telemetryCollectionStrategy: CloudintegrationtypesAzureTelemetryCollectionStrategyDTO[];+}++export interface CloudintegrationtypesAzureLogsCollectionStrategyDTO {+ /**+ * @type array+ */+ categoryGroups: string[];+}++export interface CloudintegrationtypesAzureMetricsCollectionStrategyDTO {+ [key: string]: unknown;+}++export interface CloudintegrationtypesAzureServiceConfigDTO {+ logs: CloudintegrationtypesAzureServiceLogsConfigDTO;+ metrics: CloudintegrationtypesAzureServiceMetricsConfigDTO;+}++export interface CloudintegrationtypesAzureServiceLogsConfigDTO {+ /**+ * @type boolean+ */+ enabled?: boolean;+}++export interface CloudintegrationtypesAzureServiceMetricsConfigDTO {+ /**+ * @type boolean+ */+ enabled?: boolean;+}++export interface CloudintegrationtypesAzureTelemetryCollectionStrategyDTO {+ logs?: CloudintegrationtypesAzureLogsCollectionStrategyDTO;+ metrics?: CloudintegrationtypesAzureMetricsCollectionStrategyDTO;+ /**+ * @type string+ */+ resourceProvider: string;+ /**+ * @type string+ */+ resourceType: string;+}+/*** @nullable*/@@ -890,7 +971,8 @@ export interface CloudintegrationtypesCollectedMetricDTO {}export interface CloudintegrationtypesConnectionArtifactDTO {- aws: CloudintegrationtypesAWSConnectionArtifactDTO;+ aws?: CloudintegrationtypesAWSConnectionArtifactDTO;+ azure?: CloudintegrationtypesAzureConnectionArtifactDTO;}export interface CloudintegrationtypesCredentialsDTO {@@ -1074,7 +1156,8 @@ export interface CloudintegrationtypesPostableAccountDTO {}export interface CloudintegrationtypesPostableAccountConfigDTO {- aws: CloudintegrationtypesAWSPostableAccountConfigDTO;+ aws?: CloudintegrationtypesAWSPostableAccountConfigDTO;+ azure?: CloudintegrationtypesAzureAccountConfigDTO;}/**@@ -1109,7 +1192,8 @@ export interface CloudintegrationtypesPostableAgentCheckInDTO {}export interface CloudintegrationtypesProviderIntegrationConfigDTO {- aws: CloudintegrationtypesAWSIntegrationConfigDTO;+ aws?: CloudintegrationtypesAWSIntegrationConfigDTO;+ azure?: CloudintegrationtypesAzureIntegrationConfigDTO;}export interface CloudintegrationtypesServiceDTO {@@ -1137,7 +1221,8 @@ export interface CloudintegrationtypesServiceDTO {}export interface CloudintegrationtypesServiceConfigDTO {- aws: CloudintegrationtypesAWSServiceConfigDTO;+ aws?: CloudintegrationtypesAWSServiceConfigDTO;+ azure?: CloudintegrationtypesAzureServiceConfigDTO;}export enum CloudintegrationtypesServiceIDDTO {@@ -1154,6 +1239,8 @@ export enum CloudintegrationtypesServiceIDDTO {s3sync = 's3sync',sns = 'sns',sqs = 'sqs',+ storageaccountsblob = 'storageaccountsblob',+ cdnprofile = 'cdnprofile',}export interface CloudintegrationtypesServiceMetadataDTO {/**@@ -1186,11 +1273,24 @@ export interface CloudintegrationtypesSupportedSignalsDTO {}export interface CloudintegrationtypesTelemetryCollectionStrategyDTO {- aws: CloudintegrationtypesAWSTelemetryCollectionStrategyDTO;+ aws?: CloudintegrationtypesAWSTelemetryCollectionStrategyDTO;+ azure?: CloudintegrationtypesAzureTelemetryCollectionStrategyDTO;}export interface CloudintegrationtypesUpdatableAccountDTO {- config: CloudintegrationtypesAccountConfigDTO;+ config: CloudintegrationtypesUpdatableAccountConfigDTO;+}++export interface CloudintegrationtypesUpdatableAccountConfigDTO {+ aws?: CloudintegrationtypesAWSAccountConfigDTO;+ azure?: CloudintegrationtypesUpdatableAzureAccountConfigDTO;+}++export interface CloudintegrationtypesUpdatableAzureAccountConfigDTO {+ /**+ * @type array+ */+ resourceGroups: string[];}export interface CloudintegrationtypesUpdatableServiceDTO {diff --git a/frontend/src/hooks/integration/aws/useIntegrationModal.ts b/frontend/src/hooks/integration/aws/useIntegrationModal.tsindex 2178157ef0..fb9c01bc8c 100644--- a/frontend/src/hooks/integration/aws/useIntegrationModal.ts+++ b/frontend/src/hooks/integration/aws/useIntegrationModal.ts@@ -164,7 +164,8 @@ export function useIntegrationModal({{onSuccess: (response: CreateAccountMutationResult) => {const accountId = response.data.id;- const connectionUrl = response.data.connectionArtifact.aws.connectionUrl;+ const connectionUrl =+ response.data.connectionArtifact.aws?.connectionUrl ?? '';logEvent('AWS Integration: Account connection attempt redirected to AWS',diff --git a/pkg/modules/cloudintegration/implcloudintegration/handler.go b/pkg/modules/cloudintegration/implcloudintegration/handler.goindex 13b96bdadc..91a739197b 100644--- a/pkg/modules/cloudintegration/implcloudintegration/handler.go+++ b/pkg/modules/cloudintegration/implcloudintegration/handler.go@@ -373,7 +373,13 @@ func (handler *handler) UpdateService(rw http.ResponseWriter, r *http.Request) {// update or create serviceif svc.CloudIntegrationService == nil {- cloudIntegrationService := cloudintegrationtypes.NewCloudIntegrationService(serviceID, cloudIntegrationID, req.Config)+ var cloudIntegrationService *cloudintegrationtypes.CloudIntegrationService+ cloudIntegrationService, err = cloudintegrationtypes.NewCloudIntegrationService(serviceID, cloudIntegrationID, provider, req.Config)+ if err != nil {+ render.Error(rw, err)+ return+ }+err = handler.module.CreateService(ctx, orgID, cloudIntegrationService, provider)} else {err = svc.CloudIntegrationService.Update(provider, serviceID, req.Config)diff --git a/pkg/types/cloudintegrationtypes/account.go b/pkg/types/cloudintegrationtypes/account.goindex 2b452dac69..16630ffd06 100644--- a/pkg/types/cloudintegrationtypes/account.go+++ b/pkg/types/cloudintegrationtypes/account.go@@ -29,8 +29,13 @@ type AgentReport struct {}type AccountConfig struct {- // required till new providers are added- AWS *AWSAccountConfig `json:"aws" required:"true" nullable:"false"`+ AWS *AWSAccountConfig `json:"aws,omitempty" required:"false" nullable:"false"`+ Azure *AzureAccountConfig `json:"azure,omitempty" required:"false" nullable:"false"`+}++type UpdatableAccountConfig struct {+ AWS *UpdatableAWSAccountConfig `json:"aws,omitempty" required:"false" nullable:"false"`+ Azure *UpdatableAzureAccountConfig `json:"azure,omitempty" required:"false" nullable:"false"`}type PostableAccount struct {@@ -41,7 +46,8 @@ type PostableAccount struct {type PostableAccountConfig struct {// as agent version is common for all providers, we can keep it at top level of this structAgentVersion string- AWS *AWSPostableAccountConfig `json:"aws" required:"true" nullable:"false"`+ AWS *AWSPostableAccountConfig `json:"aws,omitempty" required:"false" nullable:"false"`+ Azure *AzurePostableAccountConfig `json:"azure,omitempty" required:"false" nullable:"false"`}type Credentials struct {@@ -58,7 +64,8 @@ type GettableAccountWithConnectionArtifact struct {type ConnectionArtifact struct {// required till new providers are added- AWS *AWSConnectionArtifact `json:"aws" required:"true" nullable:"false"`+ AWS *AWSConnectionArtifact `json:"aws,omitempty" required:"false" nullable:"false"`+ Azure *AzureConnectionArtifact `json:"azure,omitempty" required:"false" nullable:"false"`}type GetConnectionArtifactRequest = PostableAccount@@ -68,7 +75,7 @@ type GettableAccounts struct {}type UpdatableAccount struct {- Config *AccountConfig `json:"config" required:"true" nullable:"false"`+ Config *UpdatableAccountConfig `json:"config" required:"true" nullable:"false"`}func NewAccount(orgID valuer.UUID, provider CloudProviderType, config *AccountConfig) *Account {@@ -119,6 +126,13 @@ func NewAccountFromStorable(storableAccount *StorableCloudIntegration) (*Accountreturn nil, err}account.Config.AWS = awsConfig+ case CloudProviderTypeAzure:+ azureConfig := new(AzureAccountConfig)+ err := json.Unmarshal([]byte(storableAccount.Config), azureConfig)+ if err != nil {+ return nil, err+ }+ account.Config.Azure = azureConfig}if storableAccount.LastAgentReport != nil {@@ -179,6 +193,24 @@ func NewAccountConfigFromPostable(provider CloudProviderType, config *PostableAc}return &AccountConfig{AWS: &AWSAccountConfig{Regions: config.AWS.Regions}}, nil+ case CloudProviderTypeAzure:+ if config.Azure == nil {+ return nil, errors.NewInvalidInputf(ErrCodeInvalidInput, "Azure config can not be nil for Azure provider")+ }++ if config.Azure.DeploymentRegion == "" {+ return nil, errors.NewInvalidInputf(ErrCodeInvalidInput, "deployment region is required for Azure provider")+ }++ if err := validateAzureRegion(config.Azure.DeploymentRegion); err != nil {+ return nil, err+ }++ if len(config.Azure.ResourceGroups) == 0 {+ return nil, errors.NewInvalidInputf(ErrCodeInvalidInput, "at least one resource group is required for Azure provider")+ }++ return &AccountConfig{Azure: &AzureAccountConfig{DeploymentRegion: config.Azure.DeploymentRegion, ResourceGroups: config.Azure.ResourceGroups}}, nildefault:return nil, errors.NewInvalidInputf(ErrCodeCloudProviderInvalidInput, "invalid cloud provider: %s", provider.StringValue())}@@ -202,6 +234,16 @@ func NewAccountConfigFromUpdatable(provider CloudProviderType, config *Updatable}return &AccountConfig{AWS: &AWSAccountConfig{Regions: config.Config.AWS.Regions}}, nil+ case CloudProviderTypeAzure:+ if config.Config.Azure == nil {+ return nil, errors.NewInvalidInputf(ErrCodeInvalidInput, "Azure config can not be nil for Azure provider")+ }++ if len(config.Config.Azure.ResourceGroups) == 0 {+ return nil, errors.NewInvalidInputf(ErrCodeInvalidInput, "at least one resource group is required for Azure provider")+ }++ return &AccountConfig{Azure: &AzureAccountConfig{ResourceGroups: config.Config.Azure.ResourceGroups}}, nildefault:return nil, errors.NewInvalidInputf(ErrCodeCloudProviderInvalidInput, "invalid cloud provider: %s", provider.StringValue())}@@ -223,8 +265,14 @@ func GetSigNozAPIURLFromDeployment(deployment *zeustypes.GettableDeployment) (st}func (account *Account) Update(provider CloudProviderType, config *AccountConfig) error {+ // deployment region can not be updated once set for Azure+ if provider == CloudProviderTypeAzure {+ config.Azure.DeploymentRegion = account.Config.Azure.DeploymentRegion+ }+account.Config = configaccount.UpdatedAt = time.Now()+return nil}@@ -288,6 +336,10 @@ func (config *AccountConfig) ToJSON() ([]byte, error) {return json.Marshal(config.AWS)}+ if config.Azure != nil {+ return json.Marshal(config.Azure)+ }+return nil, errors.NewInternalf(errors.CodeInternal, "no provider account config found")}diff --git a/pkg/types/cloudintegrationtypes/checkin.go b/pkg/types/cloudintegrationtypes/checkin.goindex a810bf5d03..50768e91e3 100644--- a/pkg/types/cloudintegrationtypes/checkin.go+++ b/pkg/types/cloudintegrationtypes/checkin.go@@ -48,7 +48,8 @@ type IntegrationConfig struct {}type ProviderIntegrationConfig struct {- AWS *AWSIntegrationConfig `json:"aws" required:"true" nullable:"false"`+ AWS *AWSIntegrationConfig `json:"aws,omitempty" required:"false" nullable:"false"`+ Azure *AzureIntegrationConfig `json:"azure,omitempty" required:"false" nullable:"false"`}// NewGettableAgentCheckIn constructs a backward-compatible response from an AgentCheckInResponse.diff --git a/pkg/types/cloudintegrationtypes/cloudintegration.go b/pkg/types/cloudintegrationtypes/cloudintegration.goindex ba53b4158c..2cfb5509c4 100644--- a/pkg/types/cloudintegrationtypes/cloudintegration.go+++ b/pkg/types/cloudintegrationtypes/cloudintegration.go@@ -61,7 +61,8 @@ type StorableCloudIntegrationService struct {// Following Service config types are only internally used to store service config in DB and use JSON snake case keys for backward compatibility.type StorableServiceConfig struct {- AWS *StorableAWSServiceConfig+ AWS *StorableAWSServiceConfig+ Azure *StorableAzureServiceConfig}type StorableAWSServiceConfig struct {@@ -78,6 +79,19 @@ type StorableAWSMetricsServiceConfig struct {Enabled bool `json:"enabled"`}+type StorableAzureServiceConfig struct {+ Logs *StorableAzureLogsServiceConfig `json:"logs,omitempty"`+ Metrics *StorableAzureMetricsServiceConfig `json:"metrics,omitempty"`+}++type StorableAzureLogsServiceConfig struct {+ Enabled bool `json:"enabled"`+}++type StorableAzureMetricsServiceConfig struct {+ Enabled bool `json:"enabled"`+}+// Scan scans value from DB.func (r *StorableAgentReport) Scan(src any) error {var data []byte@@ -187,6 +201,30 @@ func newStorableServiceConfig(provider CloudProviderType, serviceID ServiceID, s}return &StorableServiceConfig{AWS: storableAWSServiceConfig}, nil+ case CloudProviderTypeAzure:+ storableAzureServiceConfig := new(StorableAzureServiceConfig)++ if supportedSignals.Logs {+ if serviceConfig.Azure.Logs == nil {+ return nil, errors.NewInvalidInputf(ErrCodeCloudIntegrationInvalidConfig, "logs config is required for Azure service: %s", serviceID.StringValue())+ }++ storableAzureServiceConfig.Logs = &StorableAzureLogsServiceConfig{+ Enabled: serviceConfig.Azure.Logs.Enabled,+ }+ }++ if supportedSignals.Metrics {+ if serviceConfig.Azure.Metrics == nil {+ return nil, errors.NewInvalidInputf(ErrCodeCloudIntegrationInvalidConfig, "metrics config is required for Azure service: %s", serviceID.StringValue())+ }++ storableAzureServiceConfig.Metrics = &StorableAzureMetricsServiceConfig{+ Enabled: serviceConfig.Azure.Metrics.Enabled,+ }+ }++ return &StorableServiceConfig{Azure: storableAzureServiceConfig}, nildefault:return nil, errors.NewInvalidInputf(ErrCodeCloudProviderInvalidInput, "invalid cloud provider: %s", provider.StringValue())}@@ -201,6 +239,13 @@ func newStorableServiceConfigFromJSON(provider CloudProviderType, jsonStr stringreturn nil, errors.WrapInternalf(err, errors.CodeInternal, "couldn't parse AWS service config JSON")}return &StorableServiceConfig{AWS: awsConfig}, nil+ case CloudProviderTypeAzure:+ azureConfig := new(StorableAzureServiceConfig)+ err := json.Unmarshal([]byte(jsonStr), azureConfig)+ if err != nil {+ return nil, errors.WrapInternalf(err, errors.CodeInternal, "couldn't parse Azure service config JSON")+ }+ return &StorableServiceConfig{Azure: azureConfig}, nildefault:return nil, errors.NewInvalidInputf(ErrCodeCloudProviderInvalidInput, "invalid cloud provider: %s", provider.StringValue())}@@ -214,6 +259,13 @@ func (config *StorableServiceConfig) toJSON(provider CloudProviderType) ([]byte,return nil, errors.WrapInternalf(err, errors.CodeInternal, "couldn't serialize AWS service config to JSON")}+ return jsonBytes, nil+ case CloudProviderTypeAzure:+ jsonBytes, err := json.Marshal(config.Azure)+ if err != nil {+ return nil, errors.WrapInternalf(err, errors.CodeInternal, "couldn't serialize Azure service config to JSON")+ }+return jsonBytes, nildefault:return nil, errors.NewInvalidInputf(ErrCodeCloudProviderInvalidInput, "invalid cloud provider: %s", provider.StringValue())diff --git a/pkg/types/cloudintegrationtypes/cloudprovider_aws.go b/pkg/types/cloudintegrationtypes/cloudprovider_aws.goindex ed7d9388dc..8b37bef3ec 100644--- a/pkg/types/cloudintegrationtypes/cloudprovider_aws.go+++ b/pkg/types/cloudintegrationtypes/cloudprovider_aws.go@@ -23,6 +23,8 @@ type AWSAccountConfig struct {Regions []string `json:"regions" required:"true" nullable:"false"`}+type UpdatableAWSAccountConfig = AWSAccountConfig+// OldAWSCollectionStrategy is the backward-compatible snake_case form of AWSCollectionStrategy,// used in the legacy integration_config response field for older agents.type OldAWSCollectionStrategy struct {diff --git a/pkg/types/cloudintegrationtypes/cloudprovider_azure.go b/pkg/types/cloudintegrationtypes/cloudprovider_azure.gonew file mode 100644index 0000000000..7abf280b4f--- /dev/null+++ b/pkg/types/cloudintegrationtypes/cloudprovider_azure.go@@ -0,0 +1,64 @@+package cloudintegrationtypes++type AzureAccountConfig struct {+ DeploymentRegion string `json:"deploymentRegion" required:"true"`+ ResourceGroups []string `json:"resourceGroups" required:"true" nullable:"false"`+}++type UpdatableAzureAccountConfig struct {+ ResourceGroups []string `json:"resourceGroups" required:"true" nullable:"false"`+}++type AzurePostableAccountConfig = AzureAccountConfig++type AzureConnectionArtifact struct {+ CLICommand string `json:"cliCommand" required:"true"`+ CloudPowerShellCommand string `json:"cloudPowerShellCommand" required:"true"`+}++type AzureServiceConfig struct {+ Logs *AzureServiceLogsConfig `json:"logs" required:"true"`+ Metrics *AzureServiceMetricsConfig `json:"metrics" required:"true"`+}++type AzureServiceLogsConfig struct {+ Enabled bool `json:"enabled"`+}++type AzureServiceMetricsConfig struct {+ Enabled bool `json:"enabled"`+}++type AzureTelemetryCollectionStrategy struct {+ //https://learn.microsoft.com/en-us/azure/azure-resource-manager/management/resource-providers-and-types+ ResourceProvider string `json:"resourceProvider" required:"true"`+ ResourceType string `json:"resourceType" required:"true"`+ Metrics *AzureMetricsCollectionStrategy `json:"metrics,omitempty" required:"false" nullable:"false"`+ Logs *AzureLogsCollectionStrategy `json:"logs,omitempty" required:"false" nullable:"false"`+}++// AzureMetricsCollectionStrategy no additional config required for metrics, will be added in future as required.+type AzureMetricsCollectionStrategy struct{}++type AzureLogsCollectionStrategy struct {+ // List of categories to enable for diagnostic settings, to start with it will have 'allLogs' and no filtering.+ CategoryGroups []string `json:"categoryGroups" required:"true" nullable:"false"`+}++type AzureIntegrationConfig struct {+ DeploymentRegion string `json:"deploymentRegion" required:"true"`+ ResourceGroups []string `json:"resourceGroups" required:"true" nullable:"false"`+ TelemetryCollectionStrategy []*AzureTelemetryCollectionStrategy `json:"telemetryCollectionStrategy" required:"true" nullable:"false"`+}++func NewAzureIntegrationConfig(+ deploymentRegion string,+ resourceGroups []string,+ strategies []*AzureTelemetryCollectionStrategy,+) *AzureIntegrationConfig {+ return &AzureIntegrationConfig{+ DeploymentRegion: deploymentRegion,+ ResourceGroups: resourceGroups,+ TelemetryCollectionStrategy: strategies,+ }+}diff --git a/pkg/types/cloudintegrationtypes/regions.go b/pkg/types/cloudintegrationtypes/regions.goindex d8764e8aca..a2d2af9511 100644--- a/pkg/types/cloudintegrationtypes/regions.go+++ b/pkg/types/cloudintegrationtypes/regions.go@@ -165,3 +165,13 @@ func validateAWSRegion(region string) error {return errors.NewInvalidInputf(ErrCodeInvalidCloudRegion, "invalid AWS region: %s", region)}++func validateAzureRegion(region string) error {+ for _, r := range SupportedRegions[CloudProviderTypeAzure] {+ if r.StringValue() == region {+ return nil+ }+ }++ return errors.NewInvalidInputf(ErrCodeInvalidCloudRegion, "invalid Azure region: %s", region)+}diff --git a/pkg/types/cloudintegrationtypes/service.go b/pkg/types/cloudintegrationtypes/service.goindex 16f1f4ed2d..d2146e3415 100644--- a/pkg/types/cloudintegrationtypes/service.go+++ b/pkg/types/cloudintegrationtypes/service.go@@ -21,8 +21,8 @@ type CloudIntegrationService struct {}type ServiceConfig struct {- // required till new providers are added- AWS *AWSServiceConfig `json:"aws" required:"true" nullable:"false"`+ AWS *AWSServiceConfig `json:"aws,omitempty" required:"false" nullable:"false"`+ Azure *AzureServiceConfig `json:"azure,omitempty" required:"false" nullable:"false"`}// ServiceMetadata helps to quickly list available services and whether it is enabled or not.@@ -88,7 +88,8 @@ type DataCollected struct {// TelemetryCollectionStrategy is cloud provider specific configuration for signal collection,// this is used by agent to understand the nitty-gritty for collecting telemetry for the cloud provider.type TelemetryCollectionStrategy struct {- AWS *AWSTelemetryCollectionStrategy `json:"aws" required:"true" nullable:"false"`+ AWS *AWSTelemetryCollectionStrategy `json:"aws,omitempty" required:"false" nullable:"false"`+ Azure *AzureTelemetryCollectionStrategy `json:"azure,omitempty" required:"false" nullable:"false"`}// Assets represents the collection of dashboards.@@ -122,7 +123,18 @@ type Dashboard struct {Definition dashboardtypes.StorableDashboardData `json:"definition,omitempty"`}-func NewCloudIntegrationService(serviceID ServiceID, cloudIntegrationID valuer.UUID, config *ServiceConfig) *CloudIntegrationService {+func NewCloudIntegrationService(serviceID ServiceID, cloudIntegrationID valuer.UUID, provider CloudProviderType, config *ServiceConfig) (*CloudIntegrationService, error) {+ switch provider {+ case CloudProviderTypeAWS:+ if config.AWS == nil {+ return nil, errors.NewInvalidInputf(ErrCodeInvalidInput, "AWS config is required for AWS service")+ }+ case CloudProviderTypeAzure:+ if config.Azure == nil {+ return nil, errors.NewInvalidInputf(ErrCodeInvalidInput, "Azure config is required for Azure service")+ }+ }+return &CloudIntegrationService{Identifiable: types.Identifiable{ID: valuer.GenerateUUID(),@@ -134,7 +146,7 @@ func NewCloudIntegrationService(serviceID ServiceID, cloudIntegrationID valuer.UType: serviceID,Config: config,CloudIntegrationID: cloudIntegrationID,- }+ }, nil}func NewCloudIntegrationServiceFromStorable(stored *StorableCloudIntegrationService, config *ServiceConfig) *CloudIntegrationService {@@ -191,6 +203,22 @@ func NewServiceConfigFromJSON(provider CloudProviderType, jsonString string) (*S}return &ServiceConfig{AWS: awsServiceConfig}, nil+ case CloudProviderTypeAzure:+ azureServiceConfig := new(AzureServiceConfig)++ if storableServiceConfig.Azure.Logs != nil {+ azureServiceConfig.Logs = &AzureServiceLogsConfig{+ Enabled: storableServiceConfig.Azure.Logs.Enabled,+ }+ }++ if storableServiceConfig.Azure.Metrics != nil {+ azureServiceConfig.Metrics = &AzureServiceMetricsConfig{+ Enabled: storableServiceConfig.Azure.Metrics.Enabled,+ }+ }++ return &ServiceConfig{Azure: azureServiceConfig}, nildefault:return nil, errors.NewInvalidInputf(ErrCodeCloudProviderInvalidInput, "invalid cloud provider: %s", provider.StringValue())}@@ -228,6 +256,10 @@ func (config *ServiceConfig) IsServiceEnabled(provider CloudProviderType) bool {logsEnabled := config.AWS.Logs != nil && config.AWS.Logs.EnabledmetricsEnabled := config.AWS.Metrics != nil && config.AWS.Metrics.Enabledreturn logsEnabled || metricsEnabled+ case CloudProviderTypeAzure:+ logsEnabled := config.Azure.Logs != nil && config.Azure.Logs.Enabled+ metricsEnabled := config.Azure.Metrics != nil && config.Azure.Metrics.Enabled+ return logsEnabled || metricsEnableddefault:return false}@@ -239,6 +271,8 @@ func (config *ServiceConfig) IsMetricsEnabled(provider CloudProviderType) bool {switch provider {case CloudProviderTypeAWS:return config.AWS.Metrics != nil && config.AWS.Metrics.Enabled+ case CloudProviderTypeAzure:+ return config.Azure.Metrics != nil && config.Azure.Metrics.Enableddefault:return false}@@ -249,6 +283,8 @@ func (config *ServiceConfig) IsLogsEnabled(provider CloudProviderType) bool {switch provider {case CloudProviderTypeAWS:return config.AWS.Logs != nil && config.AWS.Logs.Enabled+ case CloudProviderTypeAzure:+ return config.Azure.Logs != nil && config.Azure.Logs.Enableddefault:return false}@@ -331,4 +367,3 @@ func GetDashboardsFromAssets(return dashboards}-diff --git a/pkg/types/cloudintegrationtypes/serviceid.go b/pkg/types/cloudintegrationtypes/serviceid.goindex 2bea87133d..943b4d8333 100644--- a/pkg/types/cloudintegrationtypes/serviceid.go+++ b/pkg/types/cloudintegrationtypes/serviceid.go@@ -23,6 +23,10 @@ var (AWSServiceS3Sync = ServiceID{valuer.NewString("s3sync")}AWSServiceSNS = ServiceID{valuer.NewString("sns")}AWSServiceSQS = ServiceID{valuer.NewString("sqs")}++ // Azure services.+ AzureServiceStorageAccountsBlob = ServiceID{valuer.NewString("storageaccountsblob")}+ AzureServiceCDNProfile = ServiceID{valuer.NewString("cdnprofile")})func (ServiceID) Enum() []any {@@ -40,6 +44,8 @@ func (ServiceID) Enum() []any {AWSServiceS3Sync,AWSServiceSNS,AWSServiceSQS,+ AzureServiceStorageAccountsBlob,+ AzureServiceCDNProfile,}}@@ -60,6 +66,10 @@ var SupportedServices = map[CloudProviderType][]ServiceID{AWSServiceSNS,AWSServiceSQS,},+ CloudProviderTypeAzure: {+ AzureServiceStorageAccountsBlob,+ AzureServiceCDNProfile,+ },}func NewServiceID(provider CloudProviderType, service string) (ServiceID, error) {