Documentation
¶
Index ¶
Constants ¶
const ( EnvarSuffixDBHost = "DB_HOST" EnvarSuffixGoogleBQ = "BQ_PROJECT_ID" EnvarSuffixKinesisStreamURL = "KINESIS_STREAM_URL" EnvarSuffixS3BucketURL = "S3_BUCKET" EnvarSuffixS3BucketName = "BUCKET_NAME" EnvarSuffixSQSQueueURL = "SQS_QUEUE_URL" EnvarSuffixRestfulAPI = "API_BASE_URL" )
const ( LabelAWSAPIGatewayAPI = "aws_apigatewayv2_api" LabelAWSAPIGatewayRoute = "aws_apigatewayv2_route" LabelAWSAPIGatewayIntegration = "aws_apigatewayv2_integration" LabelAWSCloudwatchEventTarget = "aws_cloudwatch_event_target" LabelAWSCron = "aws_cloudwatch_event_rule" LabelAWSEndpoint = "aws_apigatewayv2_domain_name" LabelAWSKinesisStream = "aws_kinesis_stream" LabelAWSLambdaFunction = "aws_lambda_function" LabelAWSLambdaEventSourceMapping = "aws_lambda_event_source_mapping" LabelAWSS3Bucket = "aws_s3_bucket" LabelAWSSQSQueue = "aws_sqs_queue" LabelAWSSNSTopic = "aws_sns_topic" )
AWS labels.
Variables ¶
var ( ToDatabaseCase = strcase.ToKebab ToGoogleBQCase = strcase.ToKebab ToKinesisCase = strcase.ToPascal ToLambdaCase = strcase.ToCamel ToS3BucketCase = strcase.ToKebab ToSQSCase = strcase.ToKebab ToSNSCase = strcase.ToKebab ToRestfulAPICase = strcase.ToPascal )
var AvailableTypes = []ResourceType{ APIGatewayType, CronType, DatabaseType, EndpointType, GoogleBQType, KinesisType, LambdaType, RestfulAPIType, S3Type, SQSType, SNSType}
var SuffixByResource = map[ResourceType]string{
KinesisType: "kinesis",
S3Type: "bucket",
SQSType: "sqs",
}
Functions ¶
func PrintDiff ¶ added in v0.8.0
func PrintDiff(rc1, rc2 *ResourceCollection)
PrintDiff prints the differences between two resource collections.
Types ¶
type GenericResource ¶
type GenericResource struct {
// contains filtered or unexported fields
}
GenericResource represents a generic resource.
func NewGenericResource ¶
func NewGenericResource(id, value string, resourceType ResourceType) *GenericResource
func (*GenericResource) ID ¶
func (r *GenericResource) ID() string
func (*GenericResource) ResourceType ¶
func (r *GenericResource) ResourceType() ResourceType
func (*GenericResource) Value ¶
func (r *GenericResource) Value() string
type Relationship ¶
Relationship struct representing the relationship between resources.
func FindDifferences ¶ added in v0.8.0
func FindDifferences( rc1, rc2 *ResourceCollection, ) (addedResourcesByType, removedResourcesByType map[ResourceType][]Resource, addedRelationships, removedRelationships []Relationship, )
FindDifferences finds the differences between two resource collections.
type Resource ¶
type Resource interface { ID() string Value() string ResourceType() ResourceType }
Resource interface for all resource types.
type ResourceARN ¶ added in v0.8.2
func ParseResourceARN ¶ added in v0.8.2
func ParseResourceARN(arn string, suggestedResType ResourceType) ResourceARN
func (*ResourceARN) LabelOrName ¶ added in v0.8.2
func (r *ResourceARN) LabelOrName() (value string)
type ResourceCollection ¶
type ResourceCollection struct { Resources []Resource Relationships []Relationship }
ResourceCollection represents a collection of resources and their relationships.
func NewResourceCollection ¶
func NewResourceCollection() *ResourceCollection
NewResourceCollection creates a new ResourceCollection.
func (*ResourceCollection) AddRelationship ¶
func (rc *ResourceCollection) AddRelationship(source, target Resource)
AddRelationship adds a relationship to the collection.
func (*ResourceCollection) AddResource ¶
func (rc *ResourceCollection) AddResource(resource Resource)
AddResource adds a resource to the collection.
type ResourceType ¶
type ResourceType string
ResourceType represents the type of a resource.
const ( // APIGatewayType represents the API Gateway resource type. APIGatewayType ResourceType = "apigateway" // CronType represents the Cron resource type. CronType ResourceType = "cron" // DatabaseType represents the Database resource type. DatabaseType ResourceType = "database" // EndpointType represents the Endpoint resource type. EndpointType ResourceType = "endpoint" // GoogleBQType represents the Google BigQuery resource type. GoogleBQType ResourceType = "googlebq" // KinesisType represents the Kinesis resource type. KinesisType ResourceType = "kinesis" // LambdaType represents the Lambda resource type. LambdaType ResourceType = "lambda" // RestfulAPIType represents the Restful API resource type. RestfulAPIType ResourceType = "restfulapi" // S3Type represents the S3 resource type. S3Type ResourceType = "s3" // SNSType represents the SNS resource type. SNSType ResourceType = "sns" // SQSType represents the SQS resource type. SQSType ResourceType = "sqs" // UnknownType represents an unknown resource type. UnknownType ResourceType = "unknown" )
func ParseResourceType ¶
func ParseResourceType(s string) ResourceType
ParseResourceType parses a ResourceType from a string.
func (ResourceType) String ¶
func (rt ResourceType) String() string
String returns the string representation of a ResourceType.