Skip to content

Commit

Permalink
fix: change es resource messages
Browse files Browse the repository at this point in the history
  • Loading branch information
artaasadi committed Nov 5, 2024
1 parent 0bff13a commit bdedd0f
Showing 1 changed file with 28 additions and 46 deletions.
74 changes: 28 additions & 46 deletions pkg/es/messages.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,42 +21,36 @@ type Resource struct {
EsID string `json:"es_id"`
EsIndex string `json:"es_index"`

// ID is the globally unique ID of the resource.
ID string `json:"id"`
// ID is the globally unique ID of the resource.
ARN string `json:"arn"`
// GUID is the unique Global ID of the resource
GUID string `json:"guid"`
// ResourceID is the unique ID of the resource in the integration.
ResourceID string `json:"resource_id"`
// ResourceName is the name of the resource.
ResourceName string `json:"resource_name"`
// Location is location/region of the resource
Location string `json:"location"`
// Description is the description of the resource based on the describe call.
Description interface{} `json:"description"`
// IntegrationType is the type of the integration source of the resource, i.e. AWS Cloud, Azure Cloud.
IntegrationType integration.Type `json:"integration_type"`
// ResourceType is the type of the resource.
ResourceType string `json:"resource_type"`
// ResourceJobID is the DescribeResourceJob ID that described this resource
ResourceJobID uint `json:"resource_job_id"`
// SourceID is the Source ID that the resource belongs to
SourceID string `json:"source_id"`
// SourceJobID is the DescribeSourceJob ID that the ResourceJobID was created for
SourceJobID uint `json:"source_job_id"`
// Metadata is arbitrary data associated with each resource
Metadata map[string]string `json:"metadata"`
// Tags is the list of tags associated with the resource
// IntegrationID is the integration ID that the resource belongs to
IntegrationID string `json:"integration_id"`
// IntegrationMetadata is arbitrary data associated with each resource
IntegrationMetadata map[string]string `json:"integration_metadata"`
// CanonicalTags is the list of tags associated with the resource
CanonicalTags []Tag `json:"canonical_tags"`
// Name is the name of the resource.
Name string `json:"name"`
// ResourceGroup is the group of resource (Azure only)
ResourceGroup string `json:"resource_group"`
// Location is location/region of the resource
Location string `json:"location"`
// ScheduleJobID
ScheduleJobID uint `json:"schedule_job_id"`
// CreatedAt is when the DescribeSourceJob is created
CreatedAt int64 `json:"created_at"`
// DescribedBy is the resource describe job id
DescribedBy string `json:"described_by"`
// DescribedAt is when the DescribeSourceJob is created
DescribedAt int64 `json:"described_at"`
}

func (r Resource) KeysAndIndex() ([]string, string) {
return []string{
r.ID,
r.SourceID,
r.ResourceID,
r.IntegrationID,
}, ResourceTypeToESIndex(r.ResourceType)
}

Expand All @@ -66,40 +60,28 @@ type LookupResource struct {

// ResourceID is the globally unique ID of the resource.
ResourceID string `json:"resource_id"`
// Name is the name of the resource.
Name string `json:"name"`
// ResourceName is the name of the resource.
ResourceName string `json:"resource_name"`
// IntegrationType is the type of the integration source of the resource, i.e. AWS Cloud, Azure Cloud.
IntegrationType integration.Type `json:"integration_type"`
// ResourceType is the type of the resource.
ResourceType string `json:"resource_type"`
// ServiceName is the service of the resource.
ServiceName string `json:"service_name"`
// Category is the category of the resource.
Category string `json:"category"`
// ResourceGroup is the group of resource (Azure only)
ResourceGroup string `json:"resource_group"`
// Location is location/region of the resource
Location string `json:"location"`
// SourceID is aws account id or azure subscription id
SourceID string `json:"source_id"`
// ResourceJobID is the DescribeResourceJob ID that described this resource
ResourceJobID uint `json:"resource_job_id"`
// SourceJobID is the DescribeSourceJob ID that the ResourceJobID was created for
SourceJobID uint `json:"source_job_id"`
// ScheduleJobID
ScheduleJobID uint `json:"schedule_job_id"`
// CreatedAt is when the DescribeSourceJob is created
CreatedAt int64 `json:"created_at"`
// IntegrationID is aws account id or azure subscription id
IntegrationID string `json:"integration_id"`
// IsCommon
IsCommon bool `json:"is_common"`
// Tags
Tags []Tag `json:"canonical_tags"`
// DescribedBy is the resource describe job id
DescribedBy string `json:"described_by"`
// DescribedAt is when the DescribeSourceJob is created
DescribedAt int64 `json:"described_at"`
}

func (r LookupResource) KeysAndIndex() ([]string, string) {
return []string{
r.ResourceID,
r.SourceID,
r.IntegrationID,
string(r.IntegrationType),
strings.ToLower(r.ResourceType),
}, InventorySummaryIndex
Expand Down

0 comments on commit bdedd0f

Please sign in to comment.