Skip to content

Commit

Permalink
Fix spelling and cleanup resources.go (#456)
Browse files Browse the repository at this point in the history
Fixes #452 

This fix is non-breaking. The old misspelled resource has been
deprecated, and now points to the new (correctly spelled) resource.
  • Loading branch information
iwahbe authored Sep 9, 2024
1 parent d28dcd3 commit 462b8ca
Show file tree
Hide file tree
Showing 53 changed files with 6,636 additions and 297 deletions.
2 changes: 1 addition & 1 deletion .ci-mgmt.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
provider: sumologic
major-version: 1
major-version: 0
env:
SUMOLOGIC_ACCESSID: ${{ secrets.SUMOLOGIC_ACCESSID }}
SUMOLOGIC_ACCESSKEY: ${{ secrets.SUMOLOGIC_ACCESSKEY }}
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ PULUMI_MISSING_DOCS_ERROR := true

# Override during CI using `make [TARGET] PROVIDER_VERSION=""` or by setting a PROVIDER_VERSION environment variable
# Local & branch builds will just used this fixed default version unless specified
PROVIDER_VERSION ?= 1.0.0-alpha.0+dev
PROVIDER_VERSION ?= 0.0.0-alpha.0+dev
# Use this normalised version everywhere rather than the raw input to ensure consistency.
VERSION_GENERIC = $(shell pulumictl convert-version --language generic --version "$(PROVIDER_VERSION)")

Expand Down
168 changes: 48 additions & 120 deletions provider/cmd/pulumi-resource-sumologic/bridge-metadata.json

Large diffs are not rendered by default.

339 changes: 337 additions & 2 deletions provider/cmd/pulumi-resource-sumologic/schema.json

Large diffs are not rendered by default.

161 changes: 25 additions & 136 deletions provider/resources.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2016-2018, Pulumi Corporation.
// Copyright 2016-2024, Pulumi Corporation.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -16,19 +16,16 @@ package sumologic

import (
"fmt"
"path/filepath"
"unicode"
"path"

// embed package blank import
_ "embed"
_ "embed" // embed package blank import

"github.com/SumoLogic/terraform-provider-sumologic/sumologic"
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"

"github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfbridge"
tfbridgetokens "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfbridge/tokens"
shimv1 "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim/sdk-v1"
"github.com/pulumi/pulumi/sdk/v3/go/common/tokens"

"github.com/pulumi/pulumi-sumologic/provider/pkg/version"
)
Expand All @@ -38,38 +35,15 @@ const (
// packages:
mainPkg = "sumologic"
// modules:
mainMod = "index" // the y module
mainMod = "index" // the main module
)

var namespaceMap = map[string]string{
mainPkg: "SumoLogic",
}

// makeMember manufactures a type token for the package and the given module and type.
func makeMember(mod string, mem string) tokens.ModuleMember {
return tokens.ModuleMember(mainPkg + ":" + mod + ":" + mem)
}

// makeType manufactures a type token for the package and the given module and type.
func makeType(mod string, typ string) tokens.Type {
return tokens.Type(makeMember(mod, typ))
}

// makeDataSource manufactures a standard resource token given a module and resource name. It
// automatically uses the main package and names the file by simply lower casing the data source's
// first character.
func makeDataSource(mod string, res string) tokens.ModuleMember {
fn := string(unicode.ToLower(rune(res[0]))) + res[1:]
return makeMember(mod+"/"+fn, res)
}

// makeResource manufactures a standard resource token given a module and resource name. It
// automatically uses the main package and names the file by simply lower casing the resource's
// first character.
func makeResource(mod string, res string) tokens.Type {
fn := string(unicode.ToLower(rune(res[0]))) + res[1:]
return makeType(mod+"/"+fn, res)
}
//go:embed cmd/pulumi-resource-sumologic/bridge-metadata.json
var metadata []byte

// Provider returns additional overlaid schema and metadata associated with the provider..
func Provider() tfbridge.ProviderInfo {
Expand Down Expand Up @@ -101,113 +75,41 @@ func Provider() tfbridge.ProviderInfo {
},
},
Resources: map[string]*tfbridge.ResourceInfo{
"sumologic_aws_inventory_source": {Tok: makeResource(mainMod, "AwsInventorySource")},
"sumologic_aws_xray_source": {Tok: makeResource(mainMod, "AwsXraySource")},
"sumologic_cloud_to_cloud_source": {Tok: makeResource(mainMod, "CloudToCloudSource")},
"sumologic_cloudfront_source": {Tok: makeResource(mainMod, "CloudfrontSource")},
"sumologic_cloudsyslog_source": {Tok: makeResource(mainMod, "CloudSyslogSource")},
"sumologic_cloudtrail_source": {Tok: makeResource(mainMod, "CloudtrailSource")},
"sumologic_cloudwatch_source": {Tok: makeResource(mainMod, "CloudwatchSource")},
"sumologic_collector": {Tok: makeResource(mainMod, "Collector")},
"sumologic_cloudsyslog_source": {
// Manual mapping required to keep compatible with the non-standard capitalization
// of "cloudsyslog" -> CloudSyslog".
Tok: tfbridge.MakeResource(mainPkg, mainMod, "CloudSyslogSource"),
},

"sumologic_collector_ingest_budget_assignment": {
Tok: makeResource(mainMod, "CollectorIngestBudgetAssignment"),
DeprecationMessage: "Use Collector.fields instead to assign an ingest bucket.",
Docs: noUpstreamDocs(),
Docs: &tfbridge.DocInfo{AllowMissing: true},
},
"sumologic_connection": {Tok: makeResource(mainMod, "Connection")},
"sumologic_content": {Tok: makeResource(mainMod, "Content")},
"sumologic_content_permission": {
Tok: makeResource(mainMod, "ContentPermission"),
Docs: &tfbridge.DocInfo{
Source: "content_permission_source.html.markdown",
},
},
"sumologic_cse_aggregation_rule": {Tok: makeResource(mainMod, "CseAggregationRule")},
"sumologic_cse_chain_rule": {Tok: makeResource(mainMod, "CseChainRule")},
"sumologic_cse_custom_entity_type": {Tok: makeResource(mainMod, "CseCustomEntityType")},
"sumologic_cse_custom_insight": {Tok: makeResource(mainMod, "CseCustomInsight")},
"sumologic_cse_custom_match_list_column": {Tok: makeResource(mainMod, "CseCustomMatchListColumn")},
"sumologic_cse_entity_criticality_config": {Tok: makeResource(mainMod, "CseEntityCriticalityConfig")},
"sumologic_cse_entity_entity_group_configuration": {
Tok: makeResource(mainMod, "CseEntityEntityGroupConfiguration"),
},
"sumologic_cse_entity_normalization_configuration": {
Tok: makeResource(mainMod, "CseEntityNormalizationConfiguration"),
},
"sumologic_cse_inventory_entity_group_configuration": {
Tok: makeResource(mainMod, "CseInventoryEntityGroupConfiguration"),
},
"sumologic_cse_insights_configuration": {Tok: makeResource(mainMod, "CseInsightsConfiguration")},
"sumologic_cse_insights_resolution": {Tok: makeResource(mainMod, "CseInsightsResolution")},
"sumologic_cse_insights_status": {Tok: makeResource(mainMod, "CseInsightsStatus")},
"sumologic_cse_log_mapping": {Tok: makeResource(mainMod, "CseLogMapping")},
"sumologic_cse_match_list": {
Tok: makeResource(mainMod, "CseMatchList"),
Docs: &tfbridge.DocInfo{
Source: "cse_log_match_list.html.markdown",
},
},
"sumologic_cse_match_rule": {Tok: makeResource(mainMod, "CseMatchRule")},
"sumologic_cse_network_block": {Tok: makeResource(mainMod, "CseNetworkBlock")},
"sumologic_cse_rule_tuning_expression": {Tok: makeResource(mainMod, "CseRuleTuningExpression")},
"sumologic_cse_threshold_rule": {Tok: makeResource(mainMod, "CseThresholdRule")},
"sumologic_dashboard": {Tok: makeResource(mainMod, "Dashboard")},
"sumologic_elb_source": {Tok: makeResource(mainMod, "ElbSource")},
"sumologic_field": {Tok: makeResource(mainMod, "Field")},
"sumologic_field_extraction_rule": {Tok: makeResource(mainMod, "FieldExtractionRule")},
"sumologic_folder": {Tok: makeResource(mainMod, "Folder")},
"sumologic_gcp_metrics_source": {Tok: makeResource(mainMod, "GcpMetricsSource")},
"sumologic_gcp_source": {Tok: makeResource(mainMod, "GcpSource")},
"sumologic_hierarchy": {Tok: makeResource(mainMod, "Hierarchy")},
"sumologic_http_source": {Tok: makeResource(mainMod, "HttpSource")},
"sumologic_ingest_budget": {Tok: makeResource(mainMod, "IngestBudget")},
"sumologic_ingest_budget_v2": {Tok: makeResource(mainMod, "IngestBudgetV2")},
"sumologic_installed_collector": {Tok: makeResource(mainMod, "InstalledCollector")},
"sumologic_kinesis_log_source": {Tok: makeResource(mainMod, "KineisLogSource")},
"sumologic_kinesis_metrics_source": {Tok: makeResource(mainMod, "KinesisMetricsSource")},
"sumologic_lookup_table": {Tok: makeResource(mainMod, "LookupTable")},
"sumologic_metadata_source": {Tok: makeResource(mainMod, "MetadataSource")},
"sumologic_monitor": {Tok: makeResource(mainMod, "Monitor")},
"sumologic_monitor_folder": {Tok: makeResource(mainMod, "MonitorFolder")},
"sumologic_partition": {Tok: makeResource(mainMod, "Partition")},
"sumologic_password_policy": {Tok: makeResource(mainMod, "PasswordPolicy")},
"sumologic_policies": {Tok: makeResource(mainMod, "Policies")},
"sumologic_polling_source": {Tok: makeResource(mainMod, "PollingSource")},
"sumologic_role": {Tok: makeResource(mainMod, "Role")},
"sumologic_saml_configuration": {Tok: makeResource(mainMod, "SamlConfiguration")},
"sumologic_slo": {Tok: makeResource(mainMod, "Slo")},
"sumologic_slo_folder": {Tok: makeResource(mainMod, "SloFolder")},
"sumologic_scheduled_view": {Tok: makeResource(mainMod, "ScheduledView")},
"sumologic_subdomain": {
Tok: makeResource(mainMod, "Subdomain"),
Fields: map[string]*tfbridge.SchemaInfo{
"subdomain": {
CSharpName: "SubdomainName",
},
},
},
"sumologic_s3_source": {Tok: makeResource(mainMod, "S3Source")},
"sumologic_s3_audit_source": {Tok: makeResource(mainMod, "S3AuditSource")},
"sumologic_token": {Tok: makeResource(mainMod, "Token")},
"sumologic_user": {Tok: makeResource(mainMod, "User")},
},
DataSources: map[string]*tfbridge.DataSourceInfo{
"sumologic_admin_recommended_folder": {Tok: makeDataSource(mainMod, "getAdminRecommendedFolder")},
"sumologic_caller_identity": {Tok: makeDataSource(mainMod, "getCallerIdentity")},
"sumologic_collector": {Tok: makeDataSource(mainMod, "getCollector")},
"sumologic_cse_log_mapping_vendor_product": {Tok: makeDataSource(mainMod, "getCseLogMappingVendorProduct")},
"sumologic_folder": {Tok: makeDataSource(mainMod, "getFolder")},
"sumologic_http_source": {Tok: makeDataSource(mainMod, "getHttpSource")},
"sumologic_my_user_id": {
Tok: makeDataSource(mainMod, "getMyUserId"),
// This data source is not public in the upstream docs and is probably superceded by getCallerIdentity,
// but there are no comments in the upstream repo at the time of writing that directly indicate that
// this data source is deprecated:
Docs: noUpstreamDocs(),
// This data source is not public in the upstream docs and is probably superseded
// by getCallerIdentity, but there are no comments in the upstream repo at the time
// of writing that directly indicate that this data source is deprecated:
Docs: &tfbridge.DocInfo{AllowMissing: true},
},
"sumologic_personal_folder": {Tok: makeDataSource(mainMod, "getPersonalFolder")},
"sumologic_role": {Tok: makeDataSource(mainMod, "getRole")},
"sumologic_user": {Tok: makeDataSource(mainMod, "getUser")},
},
JavaScript: &tfbridge.JavaScriptInfo{
Dependencies: map[string]string{
Expand All @@ -219,19 +121,15 @@ func Provider() tfbridge.ProviderInfo {
},
RespectSchemaVersion: true,
},
Python: (func() *tfbridge.PythonInfo {
i := &tfbridge.PythonInfo{
RespectSchemaVersion: true,
Requires: map[string]string{
"pulumi": ">=3.0.0,<4.0.0",
},
}
i.PyProject.Enabled = true
return i
})(),

Python: &tfbridge.PythonInfo{
RespectSchemaVersion: true,
Requires: map[string]string{
"pulumi": ">=3.0.0,<4.0.0",
},
PyProject: struct{ Enabled bool }{true},
},
Golang: &tfbridge.GolangInfo{
ImportBasePath: filepath.Join(
ImportBasePath: path.Join(
fmt.Sprintf("github.com/pulumi/pulumi-%[1]s/sdk/", mainPkg),
tfbridge.GetModuleMajorVersion(version.Version),
"go",
Expand All @@ -257,12 +155,3 @@ func Provider() tfbridge.ProviderInfo {

return prov
}

func noUpstreamDocs() *tfbridge.DocInfo {
return &tfbridge.DocInfo{
Markdown: []byte(" "),
}
}

//go:embed cmd/pulumi-resource-sumologic/bridge-metadata.json
var metadata []byte
44 changes: 44 additions & 0 deletions sdk/dotnet/Inputs/KinesisLogSourceAuthenticationArgs.cs

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

44 changes: 44 additions & 0 deletions sdk/dotnet/Inputs/KinesisLogSourceAuthenticationGetArgs.cs

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

26 changes: 26 additions & 0 deletions sdk/dotnet/Inputs/KinesisLogSourceDefaultDateFormatArgs.cs

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

26 changes: 26 additions & 0 deletions sdk/dotnet/Inputs/KinesisLogSourceDefaultDateFormatGetArgs.cs

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

Loading

0 comments on commit 462b8ca

Please sign in to comment.