Skip to content

Commit

Permalink
Merge pull request #325 from flanksource/feat/azure-activity-log
Browse files Browse the repository at this point in the history
feat: azure activity logs
  • Loading branch information
moshloop authored Dec 7, 2023
2 parents 9e809d9 + fe47ed7 commit 6f26eb5
Show file tree
Hide file tree
Showing 12 changed files with 267 additions and 61 deletions.
21 changes: 15 additions & 6 deletions api/v1/azure.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,19 @@ type AzureDevops struct {

type Azure struct {
BaseScraper `json:",inline"`
ConnectionName string `yaml:"connection,omitempty" json:"connection,omitempty"`
SubscriptionID string `yaml:"subscriptionID" json:"subscriptionID"`
Organisation string `yaml:"organisation" json:"organisation"`
ClientID types.EnvVar `yaml:"clientID,omitempty" json:"clientID,omitempty"`
ClientSecret types.EnvVar `yaml:"clientSecret,omitempty" json:"clientSecret,omitempty"`
TenantID string `yaml:"tenantID" json:"tenantID"`
ConnectionName string `yaml:"connection,omitempty" json:"connection,omitempty"`
SubscriptionID string `yaml:"subscriptionID" json:"subscriptionID"`
Organisation string `yaml:"organisation" json:"organisation"`
ClientID types.EnvVar `yaml:"clientID,omitempty" json:"clientID,omitempty"`
ClientSecret types.EnvVar `yaml:"clientSecret,omitempty" json:"clientSecret,omitempty"`
TenantID string `yaml:"tenantID" json:"tenantID"`
Exclusions *AzureExclusions `yaml:"exclusions,omitempty" json:"exclusions,omitempty"`
}

type AzureExclusions struct {
// ActivityLogs is a list of operations to exclude from activity logs.
// Example:
// "Microsoft.ContainerService/managedClusters/listClusterAdminCredential/action"
// "Microsoft.ContainerService/managedClusters/listClusterUserCredential/action"
ActivityLogs []string `yaml:"activityLogs,omitempty" json:"activityLogs,omitempty"`
}
3 changes: 3 additions & 0 deletions api/v1/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ type ChangeResult struct {
CreatedBy *string `json:"created_by"`
CreatedAt *time.Time `json:"created_at"`
Details map[string]interface{} `json:"details"`

// UpdateExisting indicates whether to update an existing change
UpdateExisting bool `json:"update_existing"`
}

func (r ChangeResult) AsMap() map[string]any {
Expand Down
25 changes: 25 additions & 0 deletions api/v1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions chart/crds/configs.flanksource.com_scrapeconfigs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,16 @@ spec:
items:
type: string
type: array
exclusions:
properties:
activityLogs:
description: 'ActivityLogs is a list of operations to exclude
from activity logs. Example: "Microsoft.ContainerService/managedClusters/listClusterAdminCredential/action"
"Microsoft.ContainerService/managedClusters/listClusterUserCredential/action"'
items:
type: string
type: array
type: object
format:
description: Format of config item, defaults to JSON, available
options are JSON, properties
Expand Down
2 changes: 1 addition & 1 deletion config/schemas/config_azure.schema.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"$schema":"http://json-schema.org/draft-04/schema#","$ref":"#/definitions/Azure","definitions":{"Azure":{"required":["BaseScraper","subscriptionID","organisation","tenantID"],"properties":{"BaseScraper":{"$schema":"http://json-schema.org/draft-04/schema#","$ref":"#/definitions/BaseScraper"},"connection":{"type":"string"},"subscriptionID":{"type":"string"},"organisation":{"type":"string"},"clientID":{"$schema":"http://json-schema.org/draft-04/schema#","$ref":"#/definitions/EnvVar"},"clientSecret":{"$ref":"#/definitions/EnvVar"},"tenantID":{"type":"string"}},"additionalProperties":false,"type":"object"},"BaseScraper":{"properties":{"id":{"type":"string"},"name":{"type":"string"},"items":{"type":"string"},"type":{"type":"string"},"transform":{"$schema":"http://json-schema.org/draft-04/schema#","$ref":"#/definitions/Transform"},"format":{"type":"string"},"timestampFormat":{"type":"string"},"createFields":{"items":{"type":"string"},"type":"array"},"deleteFields":{"items":{"type":"string"},"type":"array"},"tags":{"patternProperties":{".*":{"type":"string"}},"type":"object"}},"additionalProperties":false,"type":"object"},"ConfigMapKeySelector":{"required":["key"],"properties":{"name":{"type":"string"},"key":{"type":"string"}},"additionalProperties":false,"type":"object"},"EnvVar":{"properties":{"name":{"type":"string"},"value":{"type":"string"},"valueFrom":{"$schema":"http://json-schema.org/draft-04/schema#","$ref":"#/definitions/EnvVarSource"}},"additionalProperties":false,"type":"object"},"EnvVarSource":{"properties":{"configMapKeyRef":{"$schema":"http://json-schema.org/draft-04/schema#","$ref":"#/definitions/ConfigMapKeySelector"},"secretKeyRef":{"$schema":"http://json-schema.org/draft-04/schema#","$ref":"#/definitions/SecretKeySelector"}},"additionalProperties":false,"type":"object"},"Filter":{"properties":{"jsonpath":{"type":"string"}},"additionalProperties":false,"type":"object"},"Mask":{"properties":{"selector":{"$schema":"http://json-schema.org/draft-04/schema#","$ref":"#/definitions/MaskSelector"},"jsonpath":{"type":"string"},"value":{"type":"string"}},"additionalProperties":false,"type":"object"},"MaskSelector":{"properties":{"type":{"type":"string"}},"additionalProperties":false,"type":"object"},"SecretKeySelector":{"required":["key"],"properties":{"name":{"type":"string"},"key":{"type":"string"}},"additionalProperties":false,"type":"object"},"Transform":{"properties":{"gotemplate":{"type":"string"},"jsonpath":{"type":"string"},"expr":{"type":"string"},"javascript":{"type":"string"},"include":{"items":{"$schema":"http://json-schema.org/draft-04/schema#","$ref":"#/definitions/Filter"},"type":"array"},"exclude":{"items":{"$ref":"#/definitions/Filter"},"type":"array"},"mask":{"items":{"$schema":"http://json-schema.org/draft-04/schema#","$ref":"#/definitions/Mask"},"type":"array"}},"additionalProperties":false,"type":"object"}}}
{"$schema":"http://json-schema.org/draft-04/schema#","$ref":"#/definitions/Azure","definitions":{"Azure":{"required":["BaseScraper","subscriptionID","organisation","tenantID"],"properties":{"BaseScraper":{"$schema":"http://json-schema.org/draft-04/schema#","$ref":"#/definitions/BaseScraper"},"connection":{"type":"string"},"subscriptionID":{"type":"string"},"organisation":{"type":"string"},"clientID":{"$schema":"http://json-schema.org/draft-04/schema#","$ref":"#/definitions/EnvVar"},"clientSecret":{"$ref":"#/definitions/EnvVar"},"tenantID":{"type":"string"},"exclusions":{"$schema":"http://json-schema.org/draft-04/schema#","$ref":"#/definitions/AzureExclusions"}},"additionalProperties":false,"type":"object"},"AzureExclusions":{"properties":{"activityLogs":{"items":{"type":"string"},"type":"array"}},"additionalProperties":false,"type":"object"},"BaseScraper":{"properties":{"id":{"type":"string"},"name":{"type":"string"},"items":{"type":"string"},"type":{"type":"string"},"transform":{"$schema":"http://json-schema.org/draft-04/schema#","$ref":"#/definitions/Transform"},"format":{"type":"string"},"timestampFormat":{"type":"string"},"createFields":{"items":{"type":"string"},"type":"array"},"deleteFields":{"items":{"type":"string"},"type":"array"},"tags":{"patternProperties":{".*":{"type":"string"}},"type":"object"}},"additionalProperties":false,"type":"object"},"ConfigMapKeySelector":{"required":["key"],"properties":{"name":{"type":"string"},"key":{"type":"string"}},"additionalProperties":false,"type":"object"},"EnvVar":{"properties":{"name":{"type":"string"},"value":{"type":"string"},"valueFrom":{"$schema":"http://json-schema.org/draft-04/schema#","$ref":"#/definitions/EnvVarSource"}},"additionalProperties":false,"type":"object"},"EnvVarSource":{"properties":{"configMapKeyRef":{"$schema":"http://json-schema.org/draft-04/schema#","$ref":"#/definitions/ConfigMapKeySelector"},"secretKeyRef":{"$schema":"http://json-schema.org/draft-04/schema#","$ref":"#/definitions/SecretKeySelector"}},"additionalProperties":false,"type":"object"},"Filter":{"properties":{"jsonpath":{"type":"string"}},"additionalProperties":false,"type":"object"},"Mask":{"properties":{"selector":{"$schema":"http://json-schema.org/draft-04/schema#","$ref":"#/definitions/MaskSelector"},"jsonpath":{"type":"string"},"value":{"type":"string"}},"additionalProperties":false,"type":"object"},"MaskSelector":{"properties":{"type":{"type":"string"}},"additionalProperties":false,"type":"object"},"SecretKeySelector":{"required":["key"],"properties":{"name":{"type":"string"},"key":{"type":"string"}},"additionalProperties":false,"type":"object"},"Transform":{"properties":{"gotemplate":{"type":"string"},"jsonpath":{"type":"string"},"expr":{"type":"string"},"javascript":{"type":"string"},"include":{"items":{"$schema":"http://json-schema.org/draft-04/schema#","$ref":"#/definitions/Filter"},"type":"array"},"exclude":{"items":{"$ref":"#/definitions/Filter"},"type":"array"},"mask":{"items":{"$schema":"http://json-schema.org/draft-04/schema#","$ref":"#/definitions/Mask"},"type":"array"}},"additionalProperties":false,"type":"object"}}}
Loading

0 comments on commit 6f26eb5

Please sign in to comment.