Skip to content

Commit

Permalink
fix: proto messages
Browse files Browse the repository at this point in the history
  • Loading branch information
artaasadi committed Nov 5, 2024
1 parent 149c160 commit 082106f
Show file tree
Hide file tree
Showing 9 changed files with 23 additions and 908 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ require (
github.com/microsoftgraph/msgraph-sdk-go v1.51.0
github.com/microsoftgraph/msgraph-sdk-go-core v1.2.1
github.com/nats-io/nats.go v1.36.0
github.com/opengovern/og-util v1.0.6-0.20241105213733-96098f54d56c
github.com/opengovern/og-util v1.0.6-0.20241105221143-8665d83abd91
github.com/spf13/cobra v1.7.0
github.com/tombuildsstuff/giovanni v0.18.0
github.com/turbot/steampipe-plugin-sdk/v5 v5.10.1
Expand Down
6 changes: 6 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -990,6 +990,12 @@ github.com/opengovern/og-util v1.0.6-0.20241105205341-26a7e2e86ae7 h1:uhGtBSoYsn
github.com/opengovern/og-util v1.0.6-0.20241105205341-26a7e2e86ae7/go.mod h1:7l7fNhK6uewIwA0cs7QagJuhjt/E6hEAC01SR8Y0kKk=
github.com/opengovern/og-util v1.0.6-0.20241105213733-96098f54d56c h1:ZVMl52XNCTnL3Ye6zleHakK2QB27CON8PL17yEShUhI=
github.com/opengovern/og-util v1.0.6-0.20241105213733-96098f54d56c/go.mod h1:7l7fNhK6uewIwA0cs7QagJuhjt/E6hEAC01SR8Y0kKk=
github.com/opengovern/og-util v1.0.6-0.20241105214744-70a26f702ea1 h1:hH01Vpd6g9UY63eq9IyZ631BciD0WhAvCizF6ZNbED0=
github.com/opengovern/og-util v1.0.6-0.20241105214744-70a26f702ea1/go.mod h1:7l7fNhK6uewIwA0cs7QagJuhjt/E6hEAC01SR8Y0kKk=
github.com/opengovern/og-util v1.0.6-0.20241105220211-00f2ddcee156 h1:weFkN1aghClO+TFML4dw2rQ9jdO2OIFSjMoxEtF05ek=
github.com/opengovern/og-util v1.0.6-0.20241105220211-00f2ddcee156/go.mod h1:7l7fNhK6uewIwA0cs7QagJuhjt/E6hEAC01SR8Y0kKk=
github.com/opengovern/og-util v1.0.6-0.20241105221143-8665d83abd91 h1:ZIzcv1mD09wC9DdKyj/OpY5wkJvXb30rQboZ2A45umY=
github.com/opengovern/og-util v1.0.6-0.20241105221143-8665d83abd91/go.mod h1:7l7fNhK6uewIwA0cs7QagJuhjt/E6hEAC01SR8Y0kKk=
github.com/opensearch-project/opensearch-go/v2 v2.3.0 h1:nQIEMr+A92CkhHrZgUhcfsrZjibvB3APXf2a1VwCmMQ=
github.com/opensearch-project/opensearch-go/v2 v2.3.0/go.mod h1:8LDr9FCgUTVoT+5ESjc2+iaZuldqE+23Iq0r1XeNue8=
github.com/pganalyze/pg_query_go/v4 v4.2.3 h1:cNLqyiVMasV7YGWyYV+fkXyHp32gDfXVNCqoHztEGNk=
Expand Down
18 changes: 9 additions & 9 deletions pkg/describer/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,15 +184,15 @@ func DescribeHandler(ctx context.Context, logger *zap.Logger, _ TriggeredBy, inp
Error: errMsg,
ErrorCode: errCode,
DescribeJob: &golang.DescribeJob{
JobId: uint32(input.DescribeJob.JobID),
ResourceType: input.DescribeJob.ResourceType,
SourceId: input.DescribeJob.SourceID,
AccountId: input.DescribeJob.AccountID,
DescribedAt: input.DescribeJob.DescribedAt,
SourceType: string(input.DescribeJob.SourceType),
ConfigReg: input.DescribeJob.CipherText,
TriggerType: string(input.DescribeJob.TriggerType),
RetryCounter: uint32(input.DescribeJob.RetryCounter),
JobId: uint32(input.DescribeJob.JobID),
ResourceType: input.DescribeJob.ResourceType,
IntegrationId: input.DescribeJob.IntegrationID,
ProviderId: input.DescribeJob.ProviderID,
DescribedAt: input.DescribeJob.DescribedAt,
IntegrationType: string(input.DescribeJob.IntegrationType),
ConfigReg: input.DescribeJob.CipherText,
TriggerType: string(input.DescribeJob.TriggerType),
RetryCounter: uint32(input.DescribeJob.RetryCounter),
},
DescribedResourceIds: resourceIds,
})
Expand Down
2 changes: 1 addition & 1 deletion pkg/describer/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ func doDescribe(
Description: description,
IntegrationType: configs.IntegrationName,
ResourceType: strings.ToLower(job.ResourceType),
IntegrationID: job.SourceID,
IntegrationID: job.IntegrationID,
IntegrationMetadata: metadata,
CanonicalTags: newTags,
DescribedAt: job.DescribedAt,
Expand Down
41 changes: 2 additions & 39 deletions pkg/sdk/models/resource_type.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,59 +14,22 @@ type SingleResourceDescriber func(context.Context, configs.AccountCredentials, e
type ResourceType struct {
IntegrationType integration.Type

ResourceName string
ResourceLabel string
ServiceName string
ResourceName string

Tags map[string][]string

ListDescriber ResourceDescriber
GetDescriber SingleResourceDescriber

TerraformName []string
TerraformServiceName string

FastDiscovery bool
CostDiscovery bool
Summarize bool
}

func (r ResourceType) GetConnector() integration.Type {
func (r ResourceType) GetIntegrationType() integration.Type {
return r.IntegrationType
}

func (r ResourceType) GetResourceName() string {
return r.ResourceName
}

func (r ResourceType) GetResourceLabel() string {
return r.ResourceLabel
}

func (r ResourceType) GetServiceName() string {
return r.ServiceName
}

func (r ResourceType) GetTags() map[string][]string {
return r.Tags
}

func (r ResourceType) GetTerraformName() []string {
return r.TerraformName
}

func (r ResourceType) GetTerraformServiceName() string {
return r.TerraformServiceName
}

func (r ResourceType) IsFastDiscovery() bool {
return r.FastDiscovery
}

func (r ResourceType) IsCostDiscovery() bool {
return r.CostDiscovery
}

func (r ResourceType) IsSummarized() bool {
return r.Summarize
}
6 changes: 3 additions & 3 deletions provider/credentials.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ func GetResourceMetadata(job describe.DescribeJob, resource model.Resource) (map
azureMetadata := azuremodel.Metadata{
ID: resource.ID,
Name: resource.Name,
SubscriptionID: job.AccountID,
SubscriptionID: job.ProviderID,
Location: resource.Location,
CloudEnvironment: "AzurePublicCloud",
ResourceType: strings.ToLower(job.ResourceType),
SourceID: job.SourceID,
IntegrationID: job.IntegrationID,
}
azureMetadataBytes, err := json.Marshal(azureMetadata)
if err != nil {
Expand All @@ -60,7 +60,7 @@ func fixAzureLocation(l string) string {

func GetAdditionalParameters(job describe.DescribeJob) (map[string]string, error) {
additionalParameters := make(map[string]string)
additionalParameters["subscriptionId"] = job.AccountID
additionalParameters["subscriptionId"] = job.ProviderID

return additionalParameters, nil
}
Loading

0 comments on commit 082106f

Please sign in to comment.