types

package
v0.4.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 10, 2025 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AclMap = map[string]ACLMapping{
	"kafka-cluster:AlterCluster": {
		Operation:       "Alter",
		ResourceType:    "Cluster",
		RequiresPattern: false,
	},
	"kafka-cluster:AlterClusterDynamicConfiguration": {
		Operation:       "AlterConfigs",
		ResourceType:    "Cluster",
		RequiresPattern: false,
	},
	"kafka-cluster:AlterGroup": {
		Operation:       "Read",
		ResourceType:    "Group",
		RequiresPattern: true,
	},
	"kafka-cluster:AlterTopic": {
		Operation:       "Alter",
		ResourceType:    "Topic",
		RequiresPattern: true,
	},
	"kafka-cluster:AlterTopicDynamicConfiguration": {
		Operation:       "AlterConfigs",
		ResourceType:    "Topic",
		RequiresPattern: true,
	},
	"kafka-cluster:AlterTransactionalId": {
		Operation:       "Write",
		ResourceType:    "TransactionalId",
		RequiresPattern: true,
	},
	"kafka-cluster:CreateTopic": {
		Operation:       "Create",
		ResourceType:    "Topic",
		RequiresPattern: true,
	},
	"kafka-cluster:DeleteGroup": {
		Operation:       "Delete",
		ResourceType:    "Group",
		RequiresPattern: true,
	},
	"kafka-cluster:DeleteTopic": {
		Operation:       "Delete",
		ResourceType:    "Topic",
		RequiresPattern: true,
	},
	"kafka-cluster:DescribeCluster": {
		Operation:       "Describe",
		ResourceType:    "Cluster",
		RequiresPattern: false,
	},
	"kafka-cluster:DescribeClusterDynamicConfiguration": {
		Operation:       "DescribeConfigs",
		ResourceType:    "Cluster",
		RequiresPattern: false,
	},
	"kafka-cluster:DescribeGroup": {
		Operation:       "Describe",
		ResourceType:    "Group",
		RequiresPattern: true,
	},
	"kafka-cluster:DescribeTopic": {
		Operation:       "Describe",
		ResourceType:    "Topic",
		RequiresPattern: true,
	},
	"kafka-cluster:DescribeTopicDynamicConfiguration": {
		Operation:       "DescribeConfigs",
		ResourceType:    "Topic",
		RequiresPattern: true,
	},
	"kafka-cluster:DescribeTransactionalId": {
		Operation:       "Describe",
		ResourceType:    "TransactionalId",
		RequiresPattern: true,
	},
	"kafka-cluster:ReadData": {
		Operation:       "Read",
		ResourceType:    "Topic",
		RequiresPattern: true,
	},
	"kafka-cluster:WriteData": {
		Operation:       "Write",
		ResourceType:    "Topic",
		RequiresPattern: true,
	},
	"kafka-cluster:WriteDataIdempotently": {
		Operation:       "IdempotentWrite",
		ResourceType:    "Cluster",
		RequiresPattern: true,
	},
}

https://docs.aws.amazon.com/service-authorization/latest/reference/list_apachekafkaapisforamazonmskclusters.html https://docs.confluent.io/cloud/current/security/access-control/acl.html#acl-resources-and-operations-for-ccloud-summary

Functions

func AllAuthTypes

func AllAuthTypes() []string

AllAuthTypes returns all possible AuthType values as strings This can be called statically without needing an AuthType instance

Types

type ACLMapping added in v0.2.4

type ACLMapping struct {
	Operation       string
	ResourceType    string
	RequiresPattern bool
}

type AWSClientInformation added in v0.4.1

type AWSClientInformation struct {
	MskClusterConfig     kafkatypes.Cluster                     `json:"msk_cluster_config"`
	ClientVpcConnections []kafkatypes.ClientVpcConnection       `json:"client_vpc_connections"`
	ClusterOperations    []kafkatypes.ClusterOperationV2Summary `json:"cluster_operations"`
	Nodes                []kafkatypes.NodeInfo                  `json:"nodes"`
	ScramSecrets         []string                               `json:"ScramSecrets"`
	BootstrapBrokers     kafka.GetBootstrapBrokersOutput        `json:"bootstrap_brokers"`
	Policy               kafka.GetClusterPolicyOutput           `json:"policy"`
	CompatibleVersions   kafka.GetCompatibleKafkaVersionsOutput `json:"compatible_versions"`
	ClusterNetworking    ClusterNetworking                      `json:"cluster_networking"`
	Connectors           []ConnectorSummary                     `json:"connectors"`
}

func (*AWSClientInformation) GetAllBootstrapBrokersForAuthType added in v0.4.1

func (c *AWSClientInformation) GetAllBootstrapBrokersForAuthType(authType AuthType) ([]string, error)

Returns all bootstrap brokers for a given auth type.

func (*AWSClientInformation) GetBootstrapBrokersForAuthType added in v0.4.1

func (c *AWSClientInformation) GetBootstrapBrokersForAuthType(authType AuthType) ([]string, error)

Returns only one bootstrap broker per authentication type.

type Acls added in v0.2.4

type Acls struct {
	ResourceType        string `json:"ResourceType"`
	ResourceName        string `json:"ResourceName"`
	ResourcePatternType string `json:"ResourcePatternType"`
	Principal           string `json:"Principal"`
	Host                string `json:"Host"`
	Operation           string `json:"Operation"`
	PermissionType      string `json:"PermissionType"`
}

Preferred over sarama.ResourceAcls because it is flattened vs sarama's nested structure.

type AuthMethodConfig added in v0.2.8

type AuthMethodConfig struct {
	UnauthenticatedTLS       *UnauthenticatedTLSConfig       `yaml:"unauthenticated_tls,omitempty"`
	UnauthenticatedPlaintext *UnauthenticatedPlaintextConfig `yaml:"unauthenticated_plaintext,omitempty"`
	IAM                      *IAMConfig                      `yaml:"iam,omitempty"`
	TLS                      *TLSConfig                      `yaml:"tls,omitempty"`
	SASLScram                *SASLScramConfig                `yaml:"sasl_scram,omitempty"`
}

func (*AuthMethodConfig) MergeWith added in v0.4.1

func (amc *AuthMethodConfig) MergeWith(existing AuthMethodConfig)

MergeWith preserves existing auth configurations only for auth methods that still exist in the new config

type AuthType

type AuthType string

AuthType represents the different authentication types supported by MSK clusters

const (
	AuthTypeSASLSCRAM                AuthType = "SASL/SCRAM"
	AuthTypeIAM                      AuthType = "SASL/IAM"
	AuthTypeTLS                      AuthType = "TLS"
	AuthTypeUnauthenticatedPlaintext AuthType = "Unauthenticated (Plaintext)"
	AuthTypeUnauthenticatedTLS       AuthType = "Unauthenticated (TLS Encryption)"
)

func (AuthType) IsValid

func (a AuthType) IsValid() bool

func (AuthType) Values

func (a AuthType) Values() []string

Values returns all possible AuthType values as strings

type CloudWatchTimeWindow added in v0.4.1

type CloudWatchTimeWindow struct {
	StartTime time.Time
	EndTime   time.Time
	Period    int32
}

type ClusterAuth added in v0.4.1

type ClusterAuth struct {
	Name       string           `yaml:"name"`
	Arn        string           `yaml:"arn"`
	AuthMethod AuthMethodConfig `yaml:"auth_method"`
}

func (ClusterAuth) GetAuthMethods added in v0.4.1

func (ce ClusterAuth) GetAuthMethods() []AuthType

Gets a list of the authentication method(s) selected in the `creds.yaml` file generated during discovery.

func (ClusterAuth) GetSelectedAuthType added in v0.4.1

func (ce ClusterAuth) GetSelectedAuthType() (AuthType, error)

type ClusterMetrics

type ClusterMetrics struct {
	MetricMetadata MetricMetadata                     `json:"metadata"`
	Results        []cloudwatchtypes.MetricDataResult `json:"results"`
}

----- metrics -----

type ClusterNetworking added in v0.2.4

type ClusterNetworking struct {
	VpcId          string       `json:"vpc_id"`
	SubnetIds      []string     `json:"subnet_ids"`
	SecurityGroups []string     `json:"security_groups"`
	Subnets        []SubnetInfo `json:"subnets"`
}

type ConnectorSummary added in v0.4.1

type ConnectorSummary struct {
	ConnectorArn                     string                                                        `json:"connector_arn"`
	ConnectorName                    string                                                        `json:"connector_name"`
	ConnectorState                   string                                                        `json:"connector_state"`
	CreationTime                     string                                                        `json:"creation_time"`
	KafkaCluster                     kafkaconnecttypes.ApacheKafkaClusterDescription               `json:"kafka_cluster"`
	KafkaClusterClientAuthentication kafkaconnecttypes.KafkaClusterClientAuthenticationDescription `json:"kafka_cluster_client_authentication"`
	Capacity                         kafkaconnecttypes.CapacityDescription                         `json:"capacity"`
	Plugins                          []kafkaconnecttypes.PluginDescription                         `json:"plugins"`
	ConnectorConfiguration           map[string]string                                             `json:"connector_configuration"`
}

type CostAggregate added in v0.4.1

type CostAggregate struct {
	Sum     *float64 `json:"sum"`
	Average *float64 `json:"avg"`
	Maximum *float64 `json:"max"`
	Minimum *float64 `json:"min"`
}

type CostInformation added in v0.4.1

type CostInformation struct {
	CostMetadata CostMetadata                     `json:"metadata"`
	CostResults  []costexplorertypes.ResultByTime `json:"results"`
}

----- costs -----

type CostMetadata added in v0.4.1

type CostMetadata struct {
	StartDate   time.Time           `json:"start_date"`
	EndDate     time.Time           `json:"end_date"`
	Granularity string              `json:"granularity"`
	Tags        map[string][]string `json:"tags"`
	Services    []string            `json:"services"`
}

type Credentials added in v0.2.8

type Credentials struct {
	Regions []RegionAuth `yaml:"regions"`
}

func NewCredentialsFrom added in v0.4.1

func NewCredentialsFrom(fromCredentials *Credentials) *Credentials

func NewCredentialsFromFile added in v0.4.1

func NewCredentialsFromFile(credentialsYamlPath string) (*Credentials, []error)

func (*Credentials) ToYaml added in v0.2.8

func (c *Credentials) ToYaml() ([]byte, error)

func (*Credentials) UpsertRegion added in v0.4.1

func (c *Credentials) UpsertRegion(newRegion RegionAuth)

UpsertRegion inserts a new region or updates an existing one by name Automatically preserves existing cluster auth configurations

func (Credentials) Validate added in v0.2.8

func (c Credentials) Validate() (bool, []error)

func (*Credentials) WriteToFile added in v0.2.8

func (c *Credentials) WriteToFile(filePath string) error

type DiscoveredCluster added in v0.4.1

type DiscoveredCluster struct {
	Name                        string                      `json:"name"`
	Arn                         string                      `json:"arn"`
	Region                      string                      `json:"region"`
	ClusterMetrics              ClusterMetrics              `json:"metrics"`
	AWSClientInformation        AWSClientInformation        `json:"aws_client_information"`
	KafkaAdminClientInformation KafkaAdminClientInformation `json:"kafka_admin_client_information"`
}

type DiscoveredRegion added in v0.4.1

type DiscoveredRegion struct {
	Name           string                                      `json:"name"`
	Configurations []kafka.DescribeConfigurationRevisionOutput `json:"configurations"`
	Costs          CostInformation                             `json:"costs"`
	Clusters       []DiscoveredCluster                         `json:"clusters"`
	// internal only - exclude from JSON output
	ClusterArns []string `json:"-"`
}

func (*DiscoveredRegion) RefreshClusters added in v0.4.1

func (dr *DiscoveredRegion) RefreshClusters(newClusters []DiscoveredCluster)

RefreshClusters replaces the cluster list but preserves KafkaAdminClientInformation from existing clusters

type GlobalMetrics added in v0.2.6

type GlobalMetrics struct {
	GlobalPartitionCountMax float64 `json:"global_partition_count_max"`
	GlobalTopicCountMax     float64 `json:"global_topic_count_max"`
}

/ todo review if we need

type IAMConfig added in v0.2.8

type IAMConfig struct {
	Use bool `yaml:"use"`
}

type KafkaAdminClientInformation added in v0.4.1

type KafkaAdminClientInformation struct {
	ClusterID string  `json:"cluster_id"`
	Topics    *Topics `json:"topics"`
	Acls      []Acls  `json:"acls"`
}

func (*KafkaAdminClientInformation) CalculateTopicSummary added in v0.4.1

func (c *KafkaAdminClientInformation) CalculateTopicSummary() TopicSummary

func (*KafkaAdminClientInformation) SetTopics added in v0.4.1

func (c *KafkaAdminClientInformation) SetTopics(topicDetails []TopicDetails)

type KcpBuildInfo added in v0.3.2

type KcpBuildInfo struct {
	Version string `json:"version"`
	Commit  string `json:"commit"`
	Date    string `json:"date"`
}

type Manifest

type Manifest struct {
	MigrationInfraType MigrationInfraType `json:"migration_infra_type"`
}

type MetricAggregate added in v0.4.1

type MetricAggregate struct {
	Average *float64 `json:"avg"`
	Maximum *float64 `json:"max"`
	Minimum *float64 `json:"min"`
}

type MetricMetadata added in v0.4.1

type MetricMetadata struct {
	ClusterType          string    `json:"cluster_type"`
	KafkaVersion         string    `json:"kafka_version"`
	BrokerAzDistribution string    `json:"broker_az_distribution"`
	EnhancedMonitoring   string    `json:"enhanced_monitoring"`
	StartDate            time.Time `json:"start_date"`
	EndDate              time.Time `json:"end_date"`
	Period               int32     `json:"period"`

	FollowerFetching bool   `json:"follower_fetching"`
	InstanceType     string `json:"instance_type"`
	TieredStorage    bool   `json:"tiered_storage"`
}

type MigrationInfraType

type MigrationInfraType int
const (
	MskCpCcPrivateSaslIam   MigrationInfraType = 1 // MSK to CP to CC Private with SASL/IAM
	MskCpCcPrivateSaslScram MigrationInfraType = 2 // MSK to CP to CC Private with SASL/SCRAM
	MskCcPublic             MigrationInfraType = 3 // MSK to CC Public
)

func ToMigrationInfraType

func ToMigrationInfraType(input string) (MigrationInfraType, error)

func (MigrationInfraType) IsValid

func (m MigrationInfraType) IsValid() bool

type ProcessedAggregates added in v0.4.1

type ProcessedAggregates struct {
	AWSCertificateManager                ServiceCostAggregates `json:"AWS Certificate Manager"`
	AmazonManagedStreamingForApacheKafka ServiceCostAggregates `json:"Amazon Managed Streaming for Apache Kafka"`
	EC2Other                             ServiceCostAggregates `json:"EC2 - Other"`
}

ProcessedAggregates represents the three specific services we query

func NewProcessedAggregates added in v0.4.1

func NewProcessedAggregates() ProcessedAggregates

NewProcessedAggregates creates a new ProcessedAggregates with all maps initialized

type ProcessedCluster added in v0.4.1

type ProcessedCluster struct {
	Name                        string                      `json:"name"`
	Arn                         string                      `json:"arn"`
	ClusterMetrics              ProcessedClusterMetrics     `json:"metrics"` // Flattened from raw CloudWatch metrics
	AWSClientInformation        AWSClientInformation        `json:"aws_client_information"`
	KafkaAdminClientInformation KafkaAdminClientInformation `json:"kafka_admin_client_information"`
}

ProcessedCluster contains the complete cluster data with flattened metrics This is the full cluster information with processed metrics, unlike the simplified version in types.go

type ProcessedClusterMetrics added in v0.4.1

type ProcessedClusterMetrics struct {
	Region     string                     `json:"region"`
	ClusterArn string                     `json:"cluster_arn"`
	Metadata   MetricMetadata             `json:"metadata"`
	Metrics    []ProcessedMetric          `json:"results"`
	Aggregates map[string]MetricAggregate `json:"aggregates"`
}

type ProcessedCost added in v0.4.1

type ProcessedCost struct {
	Start     string                 `json:"start"`
	End       string                 `json:"end"`
	Service   string                 `json:"service"`
	UsageType string                 `json:"usage_type"`
	Values    ProcessedCostBreakdown `json:"values"`
}

type ProcessedCostBreakdown added in v0.4.1

type ProcessedCostBreakdown struct {
	UnblendedCost    float64 `json:"unblended_cost"`
	BlendedCost      float64 `json:"blended_cost"`
	AmortizedCost    float64 `json:"amortized_cost"`
	NetAmortizedCost float64 `json:"net_amortized_cost"`
	NetUnblendedCost float64 `json:"net_unblended_cost"`
}

type ProcessedMetric added in v0.4.1

type ProcessedMetric struct {
	Start string   `json:"start"`
	End   string   `json:"end"`
	Label string   `json:"label"`
	Value *float64 `json:"value"`
}

type ProcessedRegion added in v0.4.1

type ProcessedRegion struct {
	Name           string                                      `json:"name"`
	Configurations []kafka.DescribeConfigurationRevisionOutput `json:"configurations"`
	Costs          ProcessedRegionCosts                        `json:"costs"`    // Flattened from raw AWS Cost Explorer data
	Clusters       []ProcessedCluster                          `json:"clusters"` // Simplified from full DiscoveredCluster data
}

ProcessedRegion mirrors DiscoveredRegion but with flattened costs and simplified clusters

type ProcessedRegionCosts added in v0.4.1

type ProcessedRegionCosts struct {
	Region     string              `json:"region"`
	Metadata   CostMetadata        `json:"metadata"`
	Results    []ProcessedCost     `json:"results"`
	Aggregates ProcessedAggregates `json:"aggregates"`
}

type ProcessedState added in v0.4.1

type ProcessedState struct {
	Regions      []ProcessedRegion `json:"regions"`
	KcpBuildInfo KcpBuildInfo      `json:"kcp_build_info"`
	Timestamp    time.Time         `json:"timestamp"`
}

ProcessedState represents the transformed output data structure This is what comes OUT of the frontend/API after processing the raw State data Same structure as State but with costs and metrics flattened for easier frontend consumption

type RegionAuth added in v0.4.1

type RegionAuth struct {
	Name     string        `yaml:"name"`
	Clusters []ClusterAuth `yaml:"clusters"`
}

func (*RegionAuth) MergeClusterConfigs added in v0.4.1

func (ra *RegionAuth) MergeClusterConfigs(existingRegion RegionAuth)

MergeClusterConfigs preserves existing cluster auth configurations from the existing region

type SASLScramConfig added in v0.2.8

type SASLScramConfig struct {
	Use      bool   `yaml:"use"`
	Username string `yaml:"username"`
	Password string `yaml:"password"`
}

type ServiceCostAggregates added in v0.4.1

type ServiceCostAggregates struct {
	UnblendedCost    map[string]any `json:"unblended_cost"`
	BlendedCost      map[string]any `json:"blended_cost"`
	AmortizedCost    map[string]any `json:"amortized_cost"`
	NetAmortizedCost map[string]any `json:"net_amortized_cost"`
	NetUnblendedCost map[string]any `json:"net_unblended_cost"`
}

ServiceCostAggregates represents cost aggregates for a single service Uses explicit fields for each metric type instead of a map

type State added in v0.4.1

type State struct {
	Regions      []DiscoveredRegion `json:"regions"`
	KcpBuildInfo KcpBuildInfo       `json:"kcp_build_info"`
	Timestamp    time.Time          `json:"timestamp"`
}

State represents the raw input data structure (kcp-state.json file) This is what gets fed INTO the frontend/API for processing

func NewStateFrom added in v0.4.1

func NewStateFrom(fromState *State) *State

func NewStateFromFile added in v0.4.1

func NewStateFromFile(stateFile string) (*State, error)

func (*State) PersistStateFile added in v0.4.1

func (s *State) PersistStateFile(stateFile string) error

func (*State) UpsertRegion added in v0.4.1

func (s *State) UpsertRegion(newRegion DiscoveredRegion)

UpsertRegion inserts a new region or updates an existing one by name Automatically preserves KafkaAdminClientInformation from existing clusters

func (*State) WriteToFile added in v0.4.1

func (s *State) WriteToFile(filePath string) error

type SubnetInfo added in v0.2.4

type SubnetInfo struct {
	SubnetMskBrokerId int    `json:"subnet_msk_broker_id"`
	SubnetId          string `json:"subnet_id"`
	AvailabilityZone  string `json:"availability_zone"`
	PrivateIpAddress  string `json:"private_ip_address"`
	CidrBlock         string `json:"cidr_block"`
}

type TLSConfig added in v0.2.8

type TLSConfig struct {
	Use        bool   `yaml:"use"`
	CACert     string `yaml:"ca_cert"`
	ClientCert string `yaml:"client_cert"`
	ClientKey  string `yaml:"client_key"`
}

type TerraformOutput

type TerraformOutput struct {
	ConfluentCloudClusterApiKey                TerraformOutputValue `json:"confluent_cloud_cluster_api_key"`
	ConfluentCloudClusterApiKeySecret          TerraformOutputValue `json:"confluent_cloud_cluster_api_key_secret"`
	ConfluentCloudClusterId                    TerraformOutputValue `json:"confluent_cloud_cluster_id"`
	ConfluentCloudClusterRestEndpoint          TerraformOutputValue `json:"confluent_cloud_cluster_rest_endpoint"`
	ConfluentCloudClusterBootstrapEndpoint     TerraformOutputValue `json:"confluent_cloud_cluster_bootstrap_endpoint"`
	ConfluentPlatformControllerBootstrapServer TerraformOutputValue `json:"confluent_platform_controller_bootstrap_server"`
}

a type for the output.json file in the target_env folder

type TerraformOutputValue

type TerraformOutputValue struct {
	Sensitive bool   `json:"sensitive"`
	Type      string `json:"type"`
	Value     any    `json:"value"`
}

type TerraformState

type TerraformState struct {
	Outputs TerraformOutput `json:"outputs"`
}

type TopicDetails added in v0.3.4

type TopicDetails struct {
	Name              string             `json:"name"`
	Partitions        int                `json:"partitions"`
	ReplicationFactor int                `json:"replication_factor"`
	Configurations    map[string]*string `json:"configurations"`
}

type TopicSummary added in v0.3.4

type TopicSummary struct {
	Topics                    int `json:"topics"`
	InternalTopics            int `json:"internal_topics"`
	TotalPartitions           int `json:"total_partitions"`
	TotalInternalPartitions   int `json:"total_internal_partitions"`
	CompactTopics             int `json:"compact_topics"`
	CompactInternalTopics     int `json:"compact_internal_topics"`
	CompactPartitions         int `json:"compact_partitions"`
	CompactInternalPartitions int `json:"compact_internal_partitions"`
}

func CalculateTopicSummaryFromDetails added in v0.3.4

func CalculateTopicSummaryFromDetails(topicDetails []TopicDetails) TopicSummary

type Topics added in v0.3.3

type Topics struct {
	Summary TopicSummary   `json:"summary"`
	Details []TopicDetails `json:"details"`
}

type UnauthenticatedPlaintextConfig added in v0.4.1

type UnauthenticatedPlaintextConfig struct {
	Use bool `yaml:"use"`
}

type UnauthenticatedTLSConfig added in v0.4.1

type UnauthenticatedTLSConfig struct {
	Use bool `yaml:"use"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL